This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-04-13
Consider:
struct A { A(); A(A&); explicit A(int); operator int() const; }; struct B { B(B&& other); A a; }; B::B(B&& other) : a(static_cast<B&&>(other).a) {} // B::B(B&& other) = default; // ill-formed void f(B& b1) { B b2 = static_cast<B&&>(b1); }
The user-defined move constructor is well-formed because B::a can be initialized via A::operator int() and A::A(int); however, Clang and GCC believe a defaulted one would be ill-formed.
What about the following, which is considered well-formed by compilers and calls A::A(C&&)?
struct C {}; struct A : C { A(); A(A&); A(C&&); }; struct B { B(B&& other); A a; }; B::B(B&& other) = default;