http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53096
Bug #: 53096
Summary: [c++11] should be possible to default a copy ctor that
takes non-const arg
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
The following code does not compile:
struct foo
{
foo() = default;
foo(foo &) = default; // ERROR HERE
foo(foo const &) = default;
};
The error is:
error: ‘foo::foo(foo&)’ declared to take non-const reference
cannot be defaulted in the class body
This was correct for the FDIS, but is now incorrect given the resolution for
core issue 1333:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1333
The code above should be accepted.