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.