@@ -5347,13 +5347,16 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
5347
5347
5348
5348
case NestedNameSpecifier::TypeSpec:
5349
5349
case NestedNameSpecifier::TypeSpecWithTemplate:
5350
- ClsType = QualType (NNS->getAsType (), 0 );
5350
+ const Type *NNSType = NNS->getAsType ();
5351
+ ClsType = QualType (NNSType, 0 );
5351
5352
// Note: if the NNS has a prefix and ClsType is a nondependent
5352
- // TemplateSpecializationType, then the NNS prefix is NOT included
5353
- // in ClsType; hence we wrap ClsType into an ElaboratedType.
5354
- // NOTE: in particular, no wrap occurs if ClsType already is an
5355
- // Elaborated, DependentName, or DependentTemplateSpecialization.
5356
- if (isa<TemplateSpecializationType>(NNS->getAsType ()))
5353
+ // TemplateSpecializationType or a RecordType, then the NNS prefix is
5354
+ // NOT included in ClsType; hence we wrap ClsType into an
5355
+ // ElaboratedType. NOTE: in particular, no wrap occurs if ClsType
5356
+ // already is an Elaborated, DependentName, or
5357
+ // DependentTemplateSpecialization.
5358
+ if (isa<TemplateSpecializationType>(NNSType) ||
5359
+ (NNSPrefix && isa<RecordType>(NNSType)))
5357
5360
ClsType = Context.getElaboratedType (ElaboratedTypeKeyword::None,
5358
5361
NNSPrefix, ClsType);
5359
5362
break ;
0 commit comments