https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120453
--- Comment #13 from Jason Merrill <jason at gcc dot gnu.org> --- In the original testcase we do choose to do NRVO, but this fails /* Don't check copy-initialization for NRV in a coroutine ramp; we implement this case as NRV, but it's specified as directly initializing the return value from get_return_object(). */ if (DECL_RAMP_FN (current_function_decl) && named_return_value_okay_p) converted = true; because DECL_RAMP_FN is null in the ramp. So then we try to do the conversion, which fails because LazyTask doesn't have a move constructor (because it has a user-declared destructor). So I think DECL_RAMP_P is the only fix we need.