https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86303
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note the rule change for C++17+ is the "Prvalue semantics" (which is described here https://en.cppreference.com/w/cpp/language/copy_elision ). In C++11 and C++14, copy elision is not required to be done and you need to do a copy so the code is invalid since there is a copy that needed to done but there is no way to do a copy in this case since the "copy constructor" cannot bind a temporary. Anyways clang accepts it for C++11 and C++14 modes is a bug there and should be reported back to them. Note clang/msvc does not even use: auto_ptr(auto_ptr_ref); for C++11 as if I mark it as delete(d), clang accepts it still. Which makes me suspecision of them doing the copy elision but then not also checking if the copy would be valid. In the case of GCC there was a bug previously where the check was not done and it was fixed and there was many complaints in then but that was over 10 years ago.