https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115806
Bug ID: 115806
Summary: No error for enum redefinition in template
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nshead at gcc dot gnu.org
Target Milestone: ---
The following code currently compiles with no error:
template <typename T>
struct S {
enum E { a };
enum E { b };
};
S<int> s;
The same code without S being a template correctly errors with:
<source>:3:10: error: multiple definition of 'enum S::E'
3 | enum E {b};
| ^
<source>:2:10: note: previous definition here
2 | enum E {a};
| ^