diff options
author | David Blaikie <dblaikie@gmail.com> | 2011-10-25 18:17:58 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2011-10-25 18:17:58 +0000 |
commit | 152aa4b87633754801598ee282e1a17c3ec49257 (patch) | |
tree | 6d95b16c9db585af2a4fc136c12c5f470c1560fc /lib/Parse/ParseDeclCXX.cpp | |
parent | 3c3b7f90a863af43fa63043d396553ecf205351c (diff) |
Fix erroneous name-specifiers prior to decltypes better/correctly as per Doug's feedback.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142935 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDeclCXX.cpp')
-rw-r--r-- | lib/Parse/ParseDeclCXX.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index bdd41a27df..8530ff2740 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -713,13 +713,20 @@ void Parser::ParseUnderlyingTypeSpecifier(DeclSpec &DS) { /// Parser::TypeResult Parser::ParseBaseTypeSpecifier(SourceLocation &BaseLoc, SourceLocation &EndLocation) { + // Parse optional nested-name-specifier + CXXScopeSpec SS; + ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false); + + BaseLoc = Tok.getLocation(); + // Parse decltype-specifier if (Tok.is(tok::kw_decltype)) { + if (SS.isNotEmpty()) + Diag(SS.getBeginLoc(), diag::err_unexpected_scope_on_base_decltype) + << FixItHint::CreateRemoval(SS.getRange()); // Fake up a Declarator to use with ActOnTypeName. DeclSpec DS(AttrFactory); - BaseLoc = Tok.getLocation(); - ParseDecltypeSpecifier(DS); EndLocation = DS.getSourceRange().getEnd(); @@ -727,12 +734,6 @@ Parser::TypeResult Parser::ParseBaseTypeSpecifier(SourceLocation &BaseLoc, return Actions.ActOnTypeName(getCurScope(), DeclaratorInfo); } - // Parse optional nested-name-specifier - CXXScopeSpec SS; - ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false); - - BaseLoc = Tok.getLocation(); - // Check whether we have a template-id that names a type. if (Tok.is(tok::annot_template_id)) { TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok); |