Title
Array names in lambda capture sets
Status
cd2
Section
7.5.5 [expr.prim.lambda]
Submitter
Daveed Vandevoorde

Created on 2008-12-10.00:00:00 last changed 143 months ago

Messages

Date: 2009-07-15.00:00:00

[Voted into the WP at the July, 2009 meeting as part of N2927.]

Date: 2009-07-15.00:00:00

Proposed resolution (July, 2009)

See document PL22.16/09-0117 = WG21 N2927.

Date: 2020-12-15.00:00:00

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.5 [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:

  1. This results in an array member of the closure object, which is initialized by copying each element, along the lines of _N4750_.15.8 [class.copy] paragraph 8.

  2. 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).

  3. This is ill-formed.

  4. 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.

  5. This is ill-formed unless the capture is “by reference.”

History
Date User Action Args
2010-03-29 00:00:00adminsetstatus: wp -> cd2
2009-11-08 00:00:00adminsetstatus: dr -> wp
2009-08-03 00:00:00adminsetmessages: + msg2234
2009-08-03 00:00:00adminsetmessages: + msg2233
2009-08-03 00:00:00adminsetstatus: open -> dr
2008-12-10 00:00:00admincreate