Created on 2010-08-03.00:00:00 last changed 130 months ago
[Voted into the WP at the November, 2010 meeting.]
Proposed resolution (September, 2010):
Change 11.4.5.3 [class.copy.ctor] 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 (other than a function or catch-clause parameter) 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 (other than a function or catch-clause parameter) 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 11.4.5.3 [class.copy.ctor] paragraph 35 as follows:
When the criteria for elision of a copy operation are met, or would be met save for the fact that the source object is a function parameter, and the object to be copied is designated by an lvalue, overload resolution...
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.
History | |||
---|---|---|---|
Date | User | Action | Args |
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 |
2010-08-03 00:00:00 | admin | create |