Title
Incorrect examples for lambda SFINAE
Status
open
Section
13.10.3.1 [temp.deduct.general]
Submitter
Brian Bi

Created on 2025-09-13.00:00:00 last changed 3 weeks ago

Messages

Date: 2025-09-22.19:23:48

Suggested resolution:

Change in 13.10.3.1 [temp.deduct.general] paragraph 9 as follows:

[ Example: ...
  template <class T>
    auto h(T) -> decltype([x = T::invalid]() { });
  void h(...);
  h(0);        // error: invalid expression not part of the immediate context OK, calls h(...)

  template <class T>
    auto i(T) -> decltype([]() -> typename T::invalid { });
  void i(...);
  i(0);        // error: invalid expression not part of the immediate context OK, calls i(...)

  template <class T>
    auto j(T t) -> decltype([](auto x) -> decltype(x.invalid) { } (t)); // #1
  void j(...);      // #2

  j(0);             // deduction fails on #1, OK, calls #2 j(...)
-- end example ]
Date: 2025-09-24.15:25:00

(From submission #761.)

After issue 2672, the third and fourth comments in Example 7 in 13.10.3.1 [temp.deduct.general] paragraph 9 incorrectly treat the lambda-introducer and trailing return type of a lambda as if they were part of the lambda body.

History
Date User Action Args
2025-09-22 19:23:48adminsetmessages: + msg8113
2025-09-13 00:00:00admincreate