https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102609

--- Comment #17 from Gašper Ažman <gasper.azman at gmail dot com> ---
Read through the patch quickly, want to suggest a few tests.

When a lambda has captures, the explicit object parameter is used to get at
them *silently*, if they are related, otherwise the program is ill-formed:

int x = 42;
auto f1 = [x](this auto&&) {
   return x;
};
auto f2 = [](this auto&&) { return 42; }

static_cast<int(*)(decltype(f1)&)>(decltype(f1)::operator()); // OK
static_cast<int(*)(int&)>(decltype(f1)::operator()); // ERROR
static_cast<int(*)(int&)>(decltype(f2)::operator()); // OK

Reply via email to