https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120453

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #9)
> OK so the reason this fails is because check_return_expr() concludes that we
> cannot do NRVO

Yes, because the implementation is permitted to use temporary objects for the
return, because the move ctor is trivial.

> and we try to do the bad conversion.

Because we're wrongly trying to call the deleted copy constructor when we
should call the move constructor, because the return is move-eligible.  That's
the bug.

Reply via email to