Question Details

No question body available.

Tags

c++ optimization nrvo

Answers (1)

January 30, 2026 Score: 0 Rep: 48,734 Quality: Low Completeness: 40%

This is a confirmed bug(missed optimization) of gcc reported as NRVO not applied where there are two different variables involved where the developer aknowledges that:

Andrew Pinski 2015-02-04 22:51:22 UTC

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.

Note that it is note there that gcc can even fail with a single variable: