http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46736
Summary: [c++0x] move constructor is not implicitly deleted
when it should be
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
$ cat test.cc
struct U {
U();
U(U const&);
};
struct X {
U const u;
X();
X(X&&);
};
X::X(X&&)=default;
X f() {
return X();
}
$ g++ -c -std=c++0x test.cc; echo $?
0
If "=default" is inside the class, gcc properly emits an error.
Another one with the same issue:
$ cat test.cc
#include <cstdlib>
#include <utility>
struct U {
U() {}
U(U const&) { abort(); }
};
struct X {
U const u;
X() : u() {}
X(X&&);
};
X::X(X&&)=default;
int main() {
X a;
X b=std::move(a);
return 0;
}
$ g++ -std=c++0x test.cc && ./a.out
Aborted