This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
[Moved to DR at the February, 2014 meeting.]
It is not clear from the description of capturing in7.5.6 [expr.prim.lambda] whether an implicit capture resultingfrom the odr-use of a member of an anonymous union captures thatmember or the anonymous union, and there is implementationdivergence. For example,
int main() { static int result; struct A { int x; }; struct B { int y; }; union { A a; B b; }; a.x = 1; [=]() mutable { a.x = 2; result = b.y; }(); if (result == 1) return 0; throw 0; }Notes from the April, 2013 meeting:
CWG decided that an attempt to capture a member of an anonymous unionshould be ill-formed.
Proposed resolution (September, 2013):
Change 7.5.6 [expr.prim.lambda] paragraph 15 as follows:
...An array of runtime bound (9.3.4.5 [dcl.array])or a memberof an anonymous union shall not be captured by copy.
Change 7.5.6 [expr.prim.lambda] paragraph 16 as follows:
...It is unspecified whether additional unnamed non-static data members aredeclared in the closure type for entities captured byreference.A member of an anonymous union shall not be captured byreference. [Note:...