diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 5 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 71f567f47a..68b27ef1f9 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -8260,10 +8260,11 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, EnumUnderlyingTy = QualType(T, 0); // All conflicts with previous declarations are recovered by - // returning the previous declaration. + // returning the previous declaration, unless this is a definition, + // in which case we want the caller to bail out. if (CheckEnumRedeclaration(NameLoc.isValid() ? NameLoc : KWLoc, ScopedEnum, EnumUnderlyingTy, PrevEnum)) - return PrevTagDecl; + return TUK == TUK_Declaration ? PrevTagDecl : 0; } if (!Invalid) { diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index afa65ea9ee..307cccce8b 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -1848,7 +1848,8 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, // specialization causes the implicit instantiation of the definitions // of unscoped member enumerations. // Record a point of instantiation for this implicit instantiation. - if (TSK == TSK_ImplicitInstantiation && !Enum->isScoped()) { + if (TSK == TSK_ImplicitInstantiation && !Enum->isScoped() && + Enum->isCompleteDefinition()) { MemberSpecializationInfo *MSInfo =Enum->getMemberSpecializationInfo(); assert(MSInfo && "no spec info for member enum specialization"); MSInfo->setTemplateSpecializationKind(TSK_ImplicitInstantiation); |