http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58328
Bug ID: 58328
Summary: [C++11] bogus: error: constructor required before
non-static data member for
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ppluzhnikov at google dot com
Google ref: b/10634418
This appears to be very similar to PR 57770
Using g++ (GCC) 4.9.0 20130904 (experimental)
cat t.cc
struct A {
struct B {
// B() {} // Uncommenting this line makes it work.
int y = 1; // Removing initializer makes it work.
};
A(const B& opts = B()) {} // Removing default makes it work.
};
g++ -c t.cc -std=c++11
t.cc: In constructor 'A::B::B()':
t.cc:2:10: error: constructor required before non-static data member for
'A::B::y' has been parsed
struct B {
^
t.cc: At global scope:
t.cc:7:23: note: synthesized method 'A::B::B()' first required here
A(const B& opts = B()) {}
^