Created on 2008-12-10.00:00:00 last changed 178 months ago
[Voted into the WP at the July, 2009 meeting as part of N2927.]
Proposed resolution (July, 2009)
See document PL22.16/09-0117 = WG21 N2927.
The current specification does not adequately describe what happens when an array name is part of the effective capture set of a lambda expression. 7.5.6 [expr.prim.lambda] paragraph 13 says that the array member of the closure object is direct-initialized by the local array; however, 9.4 [dcl.init] paragraph 16 says that such an initialization is ill-formed. There are several possibilities for handling this problem:
This results in an array member of the closure object, which is initialized by copying each element, along the lines of 11.4.5.3 [class.copy.ctor] paragraph 8.
This results in a pointer member of the closure object, initialized to point to the first element of the array (i.e., the array lvalue decays to a pointer rvalue).
This is ill-formed.
This results in a reference-to-array member of the closure object, initialized to refer to the array, regardless of whether & was used or not.
This is ill-formed unless the capture is “by reference.”
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-03-29 00:00:00 | admin | set | status: wp -> cd2 |
2009-11-08 00:00:00 | admin | set | status: dr -> wp |
2009-08-03 00:00:00 | admin | set | messages: + msg2234 |
2009-08-03 00:00:00 | admin | set | messages: + msg2233 |
2009-08-03 00:00:00 | admin | set | status: open -> dr |
2008-12-10 00:00:00 | admin | create |