https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67678
Bug ID: 67678 Summary: Nested class can be re-declared after definition Product: gcc Version: 5.2.1 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- This should give a diagnostic: struct A { struct B{}; struct B; }; 9.2 [class.mem] p1: A member shall not be declared twice in the member-specification, except that a nested class or member class template can be declared and then later defined, [...] Clang warns: x.cc:1:31: warning: class member cannot be redeclared [-Wredeclared-class-member] struct A { struct B{}; struct B; }; ^ x.cc:1:19: note: previous declaration is here struct A { struct B{}; struct B; }; ^ 1 warning generated. EDG warns: "x.cc", line 1: warning: invalid redeclaration of nested class struct A { struct B{}; struct B; }; ^