On 12/22/23 04:01, waffl3x wrote:
int n = 0;
auto f = []<typename Self>(this Self){
static_assert(__is_same (decltype(n), int));
decltype((n)) a; // { dg-error {is not captured} }
};
f();
Could you clarify if this error being removed was intentional. I do
recall that Patrick Palka wanted to remove this error in his patch, but
it seemed to me like you stated it would be incorrect to allow it.
Since the error is no longer present I assume I am misunderstanding the
exchange.
In any case, let me know if I need to modify my test case or if this
error needs to be added back in.
Removing the error was correct under
https://eel.is/c++draft/expr.prim#id.unqual-3
Naming n in that lambda would not refer a capture by copy, so the
decltype is the same as outside the lambda.
Jason