https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118874
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Looking at the simpler struct C { void *p; explicit C (void *p) : p(p) {} }; C foo (int i, void *p) { C c (p); return c; } test, -O2 -m32 vs. -O2 -m64 -mptr64 the reason why <retval> is used in the first case and not in the latter is in want_nrvo_p. can_do_nrvo_p is true in both cases, but aggregate_value_p (functype, current_function_decl) is true only in the former case but in the latter. So, the question is what is going during the coroutine handling that NRVO is still used in a function which uses pretty much the same class.