https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67342
Bug ID: 67342 Summary: Ill-formed move constructor ignored in favor of copy constructor Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- In the following code, A is neither movable nor copyable, and B has an A: #include <utility> struct A { A() { } A(A const&) = delete; A(A&& ) = delete; }; struct B { A a; B() = default; B(B const& ) : a() { } B(B&& ) = default; }; int main() { B b1; B b2(std::move(b1)); } I would expect the move constructor to be preferred and this code to fail to compile (with some diagnostic relating to the deleted A&& constructor), but instead gcc (and clang) prefers the copy constructor for b2 here and the code compiles. I suspect this is a compiler bug, as if I instead defaulted the copy constructor, gcc issues a diagnostic about "error: use of deleted function 'B::B(B&&)'"