File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1627,12 +1627,17 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
16271627 // specialization causes the implicit instantiation of the declarations, but
16281628 // not the definitions of scoped member enumerations.
16291629 //
1630- // DR1484 clarifies that enumeration definitions inside of a template
1630+ // DR1484 clarifies that enumeration definitions inside a template
16311631 // declaration aren't considered entities that can be separately instantiated
1632- // from the rest of the entity they are declared inside of .
1632+ // from the rest of the entity they are declared inside.
16331633 if (isDeclWithinFunction (D) ? D == Def : Def && !Enum->isScoped ()) {
1634- SemaRef.CurrentInstantiationScope ->InstantiatedLocal (D, Enum);
1635- InstantiateEnumDefinition (Enum, Def);
1634+ // Prevent redundant instantiation of the enumerator-definition if the
1635+ // definition has already been instantiated due to a prior
1636+ // opaque-enum-declaration.
1637+ if (PrevDecl == nullptr ) {
1638+ SemaRef.CurrentInstantiationScope ->InstantiatedLocal (D, Enum);
1639+ InstantiateEnumDefinition (Enum, Def);
1640+ }
16361641 }
16371642
16381643 return Enum;
You can’t perform that action at this time.
0 commit comments