Title
Destruction of closure objects
Status
cd2
Section
7.5.6.2 [expr.prim.lambda.closure]
Submitter
Daveed Vandevoorde

Created on 2009-01-22.00:00:00 last changed 179 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. (The question regarding the failure of 7.6.1.4 [expr.type.conv] failing to categorize T() as a temporary was split off into a separate issue; see issue 943.)

Date: 2009-03-23.00:00:00
N2800 comment UKĀ 39

The specification of closure objects is missing a couple of important points regarding their destruction. First, although 7.5.6 [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 7.6.1.4 [expr.type.conv] also does not define the conceptually-similar T() as a temporary.)

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: + msg2237
2009-08-03 00:00:00adminsetstatus: review -> dr
2009-03-23 00:00:00adminsetmessages: + msg1901
2009-03-23 00:00:00adminsetstatus: open -> review
2009-01-22 00:00:00admincreate