https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58055
marc at kdab dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marc at kdab dot com --- Comment #5 from marc at kdab dot com --- I have no clue about the architecture of GCC, but it sounds to me that NRVO is definitely a front-end optimisation, because it's allowed to change observable behaviour. E.g., you can elide the copy ctor and dtor even if they have side effects. Once you go into some intermediate representation, the information that a set of given side effects can be entirely removed is probably irrevocably lost.