This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


759. Destruction of closure objects

Section:  [expr.prim.lambda.closure]     Status: CD2     Submitter: Daveed Vandevoorde     Date: 22 January, 2009

N2800 comment UK 39

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

The specification of closure objects is missing a couple of important points regarding their destruction. First, although 7.5.5 [expr.prim.lambda] paragraph 11 mentions other implicitly-declared special member functions, it is silent on the destructor, leading to questions about whether the closure class has one or not.

Second, nothing is said about the timing of the destruction of a closure object: is it normally destroyed at the end of the full-expression to which the lambda expression belongs, and is its lifetime extended if the closure object is bound to a reference? These questions would be addressed if paragraph 2 defined the closure object as a temporary instead of just as an rvalue. (It should be noted that [expr.type.conv] also does not define the conceptually-similar T() as a temporary.)

Proposed resolution (July, 2009)

See document PL22.16/09-0117 = WG21 N2927. (The question regarding the failure of [expr.type.conv] failing to categorize T() as a temporary was split off into a separate issue; see issue 943.)