]> granicus.if.org Git - clang/commitdiff
PR14855: don't silently swallow a nested-name-specifier after a type name.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 8 Jan 2013 22:43:49 +0000 (22:43 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 8 Jan 2013 22:43:49 +0000 (22:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171908 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
test/Parser/cxx0x-decl.cpp

index fe9205069497455dbbc3ef755b4d904fc183af5d..86fc2d3a86253d738e5b528750b17a838ef8fb86 100644 (file)
@@ -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;
index 3b883dc76cde2f83135b2a83bd96942f110f337f..d74b337b313a942939214fad655d6f3b097a7928 100644 (file)
@@ -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}}