https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90849
Bug ID: 90849 Summary: Gcc accepts invalid code Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: zhonghao at pku dot org.cn Target Milestone: --- My gcc is 10.0.0, and the code is: template < typename = void > class A { public: A () : f0 ( 1 ) { } A (int); private: typedef A<> f0; }; A<> a; The code comes from a previous bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70468 It is said to be invalid and it triggers a ICE. The bug is marked as fixed. I tried gcc 10.0.0, it accepts the code. If it is invalid, gcc shall reject it. BTW, clang reject it: <source>:5:9: error: type 'A::f0' (aka 'A<>') is not a direct or virtual base of 'A<type-parameter-0-0>' A () : f0 ( 1 ) { } ^~ 1 error generated. Compiler returned: 1