[Bug c++/61087] New: Generated class default ctor (using =default;) not respecting private access?
hs at xmission dot com
gcc-bugzilla@gcc.gnu.org
Tue May 6 21:49:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61087
Bug ID: 61087
Summary: Generated class default ctor (using =default;) not
respecting private access?
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hs at xmission dot com
Here's a snippet:
----
class A {
private:
// A() {} // error, A() private
A() = default; // Actually public?
};
int main() {
A a = A(); // This works.. Should it?
};
----
Clang 3.2-7 rejects this. I recognize that, if there is no ctor specified at
all (default or otherwise), the default generated ctor is public: but a
specified default ctor might need to be private (?)
More information about the Gcc-bugs
mailing list