From 6a502c4430088fe3bac7b5886cd9425f7e306b63 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 8 Jan 2013 22:43:49 +0000 Subject: [PATCH] PR14855: don't silently swallow a nested-name-specifier after a type name. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171908 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Parse/ParseDecl.cpp | 6 +++++- test/Parser/cxx0x-decl.cpp | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index fe92050694..86fc2d3a86 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -4189,7 +4189,11 @@ void Parser::ParseDeclaratorInternal(Declarator &D, if (SS.isNotEmpty()) { if (Tok.isNot(tok::star)) { // The scope spec really belongs to the direct-declarator. - D.getCXXScopeSpec() = SS; + if (D.mayHaveIdentifier()) + D.getCXXScopeSpec() = SS; + else + AnnotateScopeToken(SS, true); + if (DirectDeclParser) (this->*DirectDeclParser)(D); return; diff --git a/test/Parser/cxx0x-decl.cpp b/test/Parser/cxx0x-decl.cpp index 3b883dc76c..d74b337b31 100644 --- a/test/Parser/cxx0x-decl.cpp +++ b/test/Parser/cxx0x-decl.cpp @@ -39,3 +39,5 @@ static_assert(something, ""); // expected-error {{undeclared identifier}} struct SS { typedef void d() = default; // expected-error {{function definition declared 'typedef'}} expected-error {{only special member functions may be defaulted}} }; + +using PR14855 = int S::; // expected-error {{expected ';' after alias declaration}} -- 2.40.0