This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-11-11


796. Lifetime of a closure object with members captured by reference

Section: 7.5.6  [expr.prim.lambda]     Status: CD2     Submitter: UK     Date: 3 March, 2009

N2800 comment UK 40

7.5.6 [expr.prim.lambda] paragraph 13 ties the effective lifetime of a closure object with members captured by reference to the innermost block scope in which the lambda appears, rather than to the lifetime of the objects to which the references are bound. This seems too restrictive.

Notes from the March, 2009 meeting:

Making the suggested change would be problematic for an implementation in which the “reference members” were actually implemented using offsets from a captured stack pointer and in which nested blocks were pushed onto the stack (to optimize space for large local objects, for example).

Proposed resolution (July, 2009)

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