]> granicus.if.org Git - clang/commitdiff
Fixed class type generation for MemberPointerType.
authorAbramo Bagnara <abramo.bagnara@gmail.com>
Thu, 10 Mar 2011 10:18:27 +0000 (10:18 +0000)
committerAbramo Bagnara <abramo.bagnara@gmail.com>
Thu, 10 Mar 2011 10:18:27 +0000 (10:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127401 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaType.cpp

index 8e857f1a6786fd8f5754fb31f9fd8eb86a6b68fc..f161f4e6234789854b86d2a1507f697d362c1f54 100644 (file)
@@ -1935,11 +1935,12 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
         case NestedNameSpecifier::TypeSpec:
         case NestedNameSpecifier::TypeSpecWithTemplate:
           ClsType = QualType(NNS->getAsType(), 0);
-          // Note: if NNS is dependent, then its prefix (if any) is already
-          // included in ClsType; this does not hold if the NNS is
-          // nondependent: in this case (if there is indeed a prefix)
-          // ClsType needs to be wrapped into an elaborated type.
-          if (NNSPrefix && !NNS->isDependent())
+          // Note: if the NNS has a prefix and ClsType is a nondependent
+          // TemplateSpecializationType, then the NNS prefix is NOT included
+          // in ClsType; hence we wrap ClsType into an ElaboratedType.
+          // NOTE: in particular, no wrap occurs if ClsType already is an
+          // Elaborated, DependentName, or DependentTemplateSpecialization.
+          if (NNSPrefix && isa<TemplateSpecializationType>(NNS->getAsType()))
             ClsType = Context.getElaboratedType(ETK_None, NNSPrefix, ClsType);
           break;
         }