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

2025-04-13


2107. Lifetime of temporaries for default arguments in array copying

Section: 6.7.7  [class.temporary]     Status: CD4     Submitter: Hubert Tong     Date: 2015-03-19

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

Proposed resolution (September, 2015):

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

There are two 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 . 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 context is when a reference is bound to a temporary.117 The temporary to which the reference is bound...