This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-12-19
Consider:
void f() { tuple<int, int> a; auto &[x, y] = a; [x] {}; // ok, captures reference to int member of 'a' by value [&] { use(x); }; // ok, capture reference by reference } void g() { struct T { int a, b; } a; auto &[x, y] = a; [x] {}; // ill-formed, 'x' does not name a variable [&] { use(x); }; // ??? }
The standard is silent on whether and how identifiers of a decomposition declaration can be captured by a lambda.
Rationale (July, 2017):
This issue is a duplicate of issue 2308.