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

--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Stephan Bergmann from comment #9)
> (In reply to Marek Polacek from comment #8)
> > It appears that the sentiment is that this testcase should actually be
> > valid
> 
> Do you have a reference for that?  The reason for this not to be valid,
> presented at the bottom of
> <http://lists.llvm.org/pipermail/cfe-dev/2018-August/059190.html> "Re:
> [cfe-dev] return lvalue move instead of copy?" looks rather convincing to me.

(Namely, slicing by move leaving the object in a partially-moved state that
might not maintain invariants.)

That's a good point.  I guess the rule we're looking for will still require
that the returned object being treated as an xvalue be bound to some rvalue
reference to the whole object, rather than a base subobject.

So Marek, please go ahead and apply your patch after all.  And similarly, maybe
refine your 87109 patch to only reject the conversion function if it comes from
a base class.

Reply via email to