]> granicus.if.org Git - clang/commitdiff
Don't form a null reference when checking for validity of an anonymous
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 17 Aug 2012 00:12:27 +0000 (00:12 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 17 Aug 2012 00:12:27 +0000 (00:12 +0000)
elaborated type specifier in template instantiation: such a specifier is always
valid because it must be specified within the definition of the type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162068 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateInstantiate.cpp

index c7cbc41b303565bd545c2525314a814a904948cf..20e755fdaee1896b44918c9f6ec31c26e5552ad3 100644 (file)
@@ -988,12 +988,11 @@ TemplateInstantiator::RebuildElaboratedType(SourceLocation KeywordLoc,
 
     SourceLocation TagLocation = KeywordLoc;
 
-    // FIXME: type might be anonymous.
     IdentifierInfo *Id = TD->getIdentifier();
 
     // TODO: should we even warn on struct/class mismatches for this?  Seems
     // like it's likely to produce a lot of spurious errors.
-    if (Keyword != ETK_None && Keyword != ETK_Typename) {
+    if (Id && Keyword != ETK_None && Keyword != ETK_Typename) {
       TagTypeKind Kind = TypeWithKeyword::getTagTypeKindForKeyword(Keyword);
       if (!SemaRef.isAcceptableTagRedeclaration(TD, Kind, /*isDefinition*/false,
                                                 TagLocation, *Id)) {