[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    [Bug c++/53637] NRVO not applied where there are two different variables involved
From:       "marc at kdab dot com" <gcc-bugzilla () gcc ! gnu ! org>
Date:       2016-02-29 19:52:16
Message-ID: bug-53637-4-dIt6gOtaCv () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]

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.=
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic