[Bug c++/54506] Defaulted move constructors and move assignment operators are erroneously defined as deleted
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Sep 9 21:37:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54506
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-09-09 21:36:40 UTC ---
The example can be simplified to
struct A
{
A() {}
A(A &&) = delete;
A &operator =(A &&) = delete;
};
struct B
{
A a;
B() = default;
};
int main()
{
B b = B();
b = B();
}
I think this is ill-formed, so G++ is right to reject it.
struct A cannot be moved because its move operations are deleted, and cannot be
copied because the implicit-declared copy operations are defined as deleted,
see [class.copy]/7. Therefore struct B cannot be moved or copied either.
More information about the Gcc-bugs
mailing list