[Bug c++/48930] New: [C++0x] Invalid implicitly declared default c'tor
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Sun May 8 17:05:00 GMT 2011
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: unassigned@gcc.gnu.org
ReportedBy: daniel.kruegler@googlemail.com
CC: jason@redhat.com
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.
More information about the Gcc-bugs
mailing list