Bug 56429 - [C++11] Explicitly defaulted private constructor is not private
Summary: [C++11] Explicitly defaulted private constructor is not private
Status: RESOLVED DUPLICATE of bug 54812
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
: 57913 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-02-22 21:50 UTC by Jonathan Wakely
Modified: 2013-07-26 12:34 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Wakely 2013-02-22 21:50:37 UTC
class A
{
    A() = default;
};
struct B : A { };

B b;

This should be rejected, but 4.6, 4.7 and 4.8 accept it.

(4.4 also accepts it, while 4.5 rejects it for a different reason.)
Comment 1 Daniel Krügler 2013-02-23 22:30:35 UTC
This issue may have similar reasons as bug 54812.
Comment 2 Jonathan Wakely 2013-07-16 16:25:14 UTC
*** Bug 57913 has been marked as a duplicate of this bug. ***
Comment 3 Jonathan Wakely 2013-07-26 12:34:37 UTC
This has just hit me again and is quite annoying if you do this specifically to prevent deletion via pointer-to-base:

*** This bug has been marked as a duplicate of bug 54812 ***