https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53815
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Keywords| |diagnostic Last reconfirmed| |2021-08-13 Severity|minor |enhancement --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed, this is just a diagnostic issue. You are missing class or an underlying type. ICC gives the closest but still misses the point slightly: <source>(13): error: an unscoped enumeration must be opaque in order to be specialized template <> enum Foo<int>::E12 ^ <source>(15): error: enumerator already declared (see constant "Foo<x>::a [with x=int]" (declared at line 5)) a, b, c ^ For C++98, gcc gives a decent error message: <source>:13:19: error: multiple definition of 'enum Foo<int>::E12' 13 | template <> enum Foo<int>::E12 | ^~~~~~~~ <source>:5:11: note: previous definition here 5 | enum E12 { a }; | ^~~ Though this could be improved, clang gives a decent one there: <source>:14:1: error: enumeration cannot be a template { ^ <source>:13:13: error: declaration does not declare anything template <> enum Foo<int>::E12 ^ ICC is not bad either: <source>(13): error: enum "Foo<x>::E12 [with x=int]" cannot be defined in the current scope template <> enum Foo<int>::E12 ^