@@ -711,8 +711,26 @@ void Parser::ParseUnderlyingTypeSpecifier(DeclSpec &DS) {
711
711
// / identifier
712
712
// / simple-template-id
713
713
// /
714
- Parser::TypeResult Parser::ParseBaseTypeSpecifier (SourceLocation &EndLocation,
715
- CXXScopeSpec &SS) {
714
+ Parser::TypeResult Parser::ParseBaseTypeSpecifier (SourceLocation &BaseLoc,
715
+ SourceLocation &EndLocation) {
716
+ // Parse decltype-specifier
717
+ if (Tok.is (tok::kw_decltype)) {
718
+ // Fake up a Declarator to use with ActOnTypeName.
719
+ DeclSpec DS (AttrFactory);
720
+
721
+ ParseDecltypeSpecifier (DS);
722
+ EndLocation = DS.getSourceRange ().getEnd ();
723
+
724
+ Declarator DeclaratorInfo (DS, Declarator::TypeNameContext);
725
+ return Actions.ActOnTypeName (getCurScope (), DeclaratorInfo);
726
+ }
727
+
728
+ // Parse optional nested-name-specifier
729
+ CXXScopeSpec SS;
730
+ ParseOptionalCXXScopeSpecifier (SS, ParsedType (), /* EnteringContext=*/ false );
731
+
732
+ BaseLoc = Tok.getLocation ();
733
+
716
734
// Check whether we have a template-id that names a type.
717
735
if (Tok.is (tok::annot_template_id)) {
718
736
TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation (Tok);
@@ -733,17 +751,6 @@ Parser::TypeResult Parser::ParseBaseTypeSpecifier(SourceLocation &EndLocation,
733
751
// Fall through to produce an error below.
734
752
}
735
753
736
- if (Tok.is (tok::kw_decltype)) {
737
- // Fake up a Declarator to use with ActOnTypeName.
738
- DeclSpec DS (AttrFactory);
739
-
740
- ParseDecltypeSpecifier (DS);
741
- EndLocation = DS.getSourceRange ().getEnd ();
742
-
743
- Declarator DeclaratorInfo (DS, Declarator::TypeNameContext);
744
- return Actions.ActOnTypeName (getCurScope (), DeclaratorInfo);
745
- }
746
-
747
754
if (Tok.isNot (tok::identifier)) {
748
755
Diag (Tok, diag::err_expected_class_name);
749
756
return true ;
@@ -1410,16 +1417,10 @@ Parser::BaseResult Parser::ParseBaseSpecifier(Decl *ClassDecl) {
1410
1417
IsVirtual = true ;
1411
1418
}
1412
1419
1413
- // Parse optional '::' and optional nested-name-specifier.
1414
- CXXScopeSpec SS;
1415
- ParseOptionalCXXScopeSpecifier (SS, ParsedType (), /* EnteringContext=*/ false );
1416
-
1417
- // The location of the base class itself.
1418
- SourceLocation BaseLoc = Tok.getLocation ();
1419
-
1420
1420
// Parse the class-name.
1421
1421
SourceLocation EndLocation;
1422
- TypeResult BaseType = ParseBaseTypeSpecifier (EndLocation, SS);
1422
+ SourceLocation BaseLoc;
1423
+ TypeResult BaseType = ParseBaseTypeSpecifier (BaseLoc, EndLocation);
1423
1424
if (BaseType.isInvalid ())
1424
1425
return true ;
1425
1426
0 commit comments