Created on 2010-08-03.00:00:00 last changed 96 months ago
[Voted into the WP at the November, 2010 meeting.]
Proposed resolution (September, 2010):
Change _N4750_.15.8 [class.copy] paragraph 34 bullets 1 and 2 as follows:
in a return statement in a function with a class return type, when the expression is the name of a non-volatile automatic object with the same cv-unqualified type as the function return type, the copy/move operation can be omitted by constructing the automatic object directly into the function's return value
in a throw-expression, when the operand is the name of a non-volatile automatic object whose scope does not extend beyond the end of the innermost enclosing try-block (if there is one), the copy/move operation from the operand to the exception object (14.2 [except.throw]) can be omitted by constructing the automatic object directly into the exception object
Change _N4750_.15.8 [class.copy] paragraph 35 as follows:
When the criteria for elision of a copy operation are met and the object to be copied is designated by an lvalue, overload resolution...[Drafting note: the change to paragraph 35 intentionally omits catch-clause parameters out of concern that a rethrow during the move would throw a stripped exception object. This should not be problematic in most cases, since exception objects are typically small.]
It is unclear whether copy elision is permitted when returning a parameter of class type. If not, it should still be possible to move, rather than copy, the return value.
Suggested resolution: Amend paragraph 34 to explicitly exclude function parameters from copy elision. Amend paragraph 35 to include function parameters as eligible for move-construction.
|2014-03-03 00:00:00||admin||set||status: fdis -> c++11|
|2011-04-10 00:00:00||admin||set||status: dr -> fdis|
|2010-11-29 00:00:00||admin||set||messages: + msg3190|
|2010-11-29 00:00:00||admin||set||status: tentatively ready -> dr|
|2010-10-18 00:00:00||admin||set||messages: + msg2988|
|2010-10-18 00:00:00||admin||set||status: drafting -> tentatively ready|