André Brand e734f01bff
[clang] Prevent duplicated instantiation of enumerators of unscoped member enumerations (#124407)
This commit addresses a bug occurring when an unscoped member enumeration
of a class template is introduced with an opaque-enum-declaration and later
redeclared with an enum-specifier (per C++23 [class.mem] p6).
Previously, the enumerators, or EnumConstantDecl, of the enum-specifier
were instantiated at both declarations, leading to different issues:
* erroneous ambiguities when referencing the enumerators,
* duplicated diagnostics in the enumerator-list.

The issue is resolved by ensuring that enumerators are instantiated only
at the first instantiated declaration, analogous to nested classes.

Fixes #124405
2025-01-27 21:42:33 +01:00
..