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

--- Comment #2 from Yunrui Wang <ph3rin at gmail dot com> ---
(In reply to Jakub Jelinek from comment #1)
> What you cite doesn't say anything that would make the testcase invalid.
> The standard says that for an implicitly movable entity seen in return
> statement shall first perform overload resolution for the copy constructor
> as if it was an rvalue, which in this case fails because the move ctor is
> deleted.  And in that case, another overload resolution is performed, this
> time considering the implicitly movable entity as lvalue, and that succeeds.
> So, if copy-ellision wouldn't be performed,
> not_movable::not_movable(not_movable const&) would be invoked, but in this
> case copy-ellision is invoked and thus it is default constructed into the
> return value object in the caller.

The first overload resolution should succeed by selecting the deleted move
constructors. Deleted functions are defined and are considered for overload
resolution (unless otherwise specified - there are some edge cases, but not in
this example).

Reply via email to