https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109443

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
No:

This elision of copy/move operations, called copy elision, is permitted in the
following circumstances (which may be combined to eliminate multiple copies):
 — in a return statement in a function with a class return type, when the
expression is the name of a non-volatile object with automatic storage duration
(other than a function parameter or a variable introduced by the
exception-declaration of a handler (14.4)) with the same type (ignoring
cv-qualification) as the function return type, the copy/move operation can be
omitted by constructing the object directly into the function call’s return
object

"Other than a function parameter" means the return object must be at a distinct
address.

Reply via email to