Title
Lifetime of temporaries for default arguments in array copying
Status
cd4
Section
6.7.7 [class.temporary]
Submitter
Hubert Tong

Created on 2015-03-19.00:00:00 last changed 87 months ago

Messages

Date: 2015-09-15.00:00:00

Proposed resolution (September, 2015):

Change 6.7.7 [class.temporary] paragraphs 4-5 as follows:

There are two three contexts in which temporaries are destroyed at a different point than the end of the full-expression. The first context is when a default constructor is called to initialize an element of an array with no corresponding initializer (9.4 [dcl.init]). The second context is when a copy constructor is called to copy an element of an array while the entire array is copied (7.5.5 [expr.prim.lambda], 11.4.5.3 [class.copy.ctor]). If In either case, if the constructor has one or more default arguments, the destruction of every temporary created in a default argument is sequenced before the construction of the next array element, if any.

The second third context is when a reference is bound to a temporary.117 The temporary to which the reference is bound...

Date: 2016-02-15.00:00:00

[Adopted at the February, 2016 meeting.]

The lifetime of temporaries introduced for default arguments in array copying is not specified clearly. Presumably it should be treated like default arguments in default constructors (6.7.7 [class.temporary] paragraph 4), which deletes each element's set of default argument temporaries before construction of the next element.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: tentatively ready -> cd4
2015-11-10 00:00:00adminsetmessages: + msg5604
2015-11-10 00:00:00adminsetstatus: drafting -> tentatively ready
2015-03-19 00:00:00admincreate