[Bug c++/53637] NRVO not applied where there are two different variables involved
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 4 22:51:00 GMT 2015
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.
More information about the Gcc-bugs
mailing list