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

--- Comment #5 from marc at kdab dot com ---
You have a very narrow test of NRVO. 

You're using a completely transparent type, though I give you that defining the
copy and move ctors in a separate TU does not change the outcome. At some point
I'll check whether having them in a different dll/so/dylib will change
something.

And you consequently don't test X's which are not created at the top-level
scope. These bug reports are about other cases.

NRVO should kick in whenever it is statically known which object is returned.

I will hand you a pull-request for some more soon, but in Qt, we have also
returns of rvalues from some switch cases mixed with returns of case-local
lvalues from others, which I didn't cover, yet. I only added slight variations
of the existing tests.

You seem to have an impressive array of compilers to run the test against, and
I invite you to add more cases where lvalues are returned where NRVO could be
used and update your interesting paper.

Reply via email to