You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
struct B {
int i;
};
int foo() {
auto [x] = B{1};
[x]() {
x = 2;
}();
return x;
}
is invalid because not-mutable lambda modifies its read-only capture x, and it is properly rejected by GCC and MSVC, but Clang erroneously admits it. Online demo: https://gcc.godbolt.org/z/46o6jad8n