From: Richard Smith Date: Tue, 8 Jan 2013 22:43:49 +0000 (+0000) Subject: PR14855: don't silently swallow a nested-name-specifier after a type name. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6a502c4430088fe3bac7b5886cd9425f7e306b63;p=clang 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 --- 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}}