http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48930
Summary: [C++0x] Invalid implicitly declared default c'tor
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
gcc 4.7.0 20110430 (experimental) in C++0x mode accepts the following code:
//-------
struct C {
C(const C&) = default;
} c1;
C c2{};
//-------
It shouldn't, the code is ill-formed, because there is a user-declared (but not
user-provided) copy-constructor. According to [class.ctor]p.5 the default
constructor of C should not be implicitly declared in this case. The defect
exists independent of the way, a default-constructed variable of type C is
declared, or whether a defaulted move constructor is added or not.