https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101288
Bug ID: 101288 Summary: Invalid instantiated redeclaration considered valid by gcc Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: eligorkadaf at gmail dot com Target Milestone: --- https://godbolt.org/z/KG5WG43vE https://eel.is/c++draft/temp.spec#temp.inst-example-4 template<class T, class U> struct Outer { template<class X, class Y> struct Inner; template<class Y> struct Inner<T, Y>; // #1a template<class Y> struct Inner<T, Y> { }; // #1b; OK: valid redeclaration of #1a template<class Y> struct Inner<U, Y> { }; // #2 }; Outer<int, int> outer; // error at #2 int main() {}