https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93106
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- 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.