Title
Temporary lifetime and move-elision
Status
cd4
Section
11.9.6 [class.copy.elision]
Submitter
Richard Smith

Created on 2014-07-11.00:00:00 last changed 87 months ago

Messages

Date: 2015-05-15.00:00:00

[Moved to DR at the May, 2015 meeting.]

Date: 2015-04-15.00:00:00

Proposed resolution (April, 2015):

Change 11.4.5.3 [class.copy.ctor] paragraph 31 as follows:

When certain criteria are met, an implementation is allowed to omit the copy/move construction of a class object, even if the constructor selected for the copy/move operation and/or the destructor for the object have side effects. In such cases, the implementation treats the source and target of the omitted copy/move operation as simply two different ways of referring to the same object, and. If the first parameter of the selected constructor is an rvalue reference to the object's type, the destruction of that object occurs when the target would have been destroyed; otherwise, the destruction occurs at the later of the times when the two objects would have been destroyed without the optimization.122 This elision of copy/move operations, called copy elision, is permitted...
Date: 2014-07-11.00:00:00

When copy elision is performed, the lifetime of the merged object ends at the later of the times the two objects' lifetimes would have ended. If the copy elision is done using a move constructor, however, it might make sense to assume that the moved-from object's lifetime is no longer interesting and the lifetime should be that of the moved-to object.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-11-10 00:00:00adminsetstatus: dr -> drwp
2015-05-25 00:00:00adminsetmessages: + msg6057
2015-05-25 00:00:00adminsetstatus: tentatively ready -> dr
2015-04-13 00:00:00adminsetmessages: + msg5316
2015-04-13 00:00:00adminsetstatus: drafting -> tentatively ready
2014-07-11 00:00:00admincreate