This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53637] NRVO not applied where there are two different variables involved
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 04 Feb 2015 22:51:22 +0000
- Subject: [Bug c++/53637] NRVO not applied where there are two different variables involved
- Auto-submitted: auto-generated
- References: <bug-53637-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53637
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-02-04
Summary|NRVO not applied in |NRVO not applied where
|branches when it could be |there are two different
| |variables involved
Ever confirmed|0 |1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The problem is that GCC does not do NRVO when there are two different variables
used. If the variable was the same, GCC would do the correct thing.
That is:
Foo bar(int i) {
Foo result;
if (i > 1) {
return result;
} else {
return result;
}
}
NRVO is applied.