Don't skip '_Alignas' when disambiguating 'final'. '_Alignas' can't appear here,
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 22 Feb 2013 06:46:23 +0000 (06:46 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 22 Feb 2013 06:46:23 +0000 (06:46 +0000)
and we used to assert if it did.

llvm-svn: 175866

clang/lib/Parse/ParseDeclCXX.cpp
clang/test/Parser/cxx0x-ambig.cpp

index 22f5863..90926a3 100644 (file)
@@ -1293,9 +1293,8 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
       // Okay, this is a class definition.
       TUK = Sema::TUK_Definition;
     }
-  } else if (isCXX11FinalKeyword() && (NextToken().is(tok::l_square) || 
-                                       NextToken().is(tok::kw_alignas) ||
-                                       NextToken().is(tok::kw__Alignas))) {
+  } else if (isCXX11FinalKeyword() && (NextToken().is(tok::l_square) ||
+                                       NextToken().is(tok::kw_alignas))) {
     // We can't tell if this is a definition or reference
     // until we skipped the 'final' and C++11 attribute specifiers.
     TentativeParsingAction PA(*this);
@@ -1309,8 +1308,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
         ConsumeBracket();
         if (!SkipUntil(tok::r_square))
           break;
-      } else if ((Tok.is(tok::kw_alignas) || Tok.is(tok::kw__Alignas)) &&
-                 NextToken().is(tok::l_paren)) {
+      } else if (Tok.is(tok::kw_alignas) && NextToken().is(tok::l_paren)) {
         ConsumeToken();
         ConsumeParen();
         if (!SkipUntil(tok::r_paren))
@@ -1503,11 +1501,6 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
                                     TemplateParams? &(*TemplateParams)[0] : 0,
                                  TemplateParams? TemplateParams->size() : 0));
   } else {
-    if (TemplateInfo.Kind == ParsedTemplateInfo::ExplicitInstantiation &&
-        TUK == Sema::TUK_Definition) {
-      // FIXME: Diagnose this particular error.
-    }
-
     if (TUK != Sema::TUK_Declaration && TUK != Sema::TUK_Definition)
       ProhibitAttributes(attrs);
 
index ac9c75e..dac3c09 100644 (file)
@@ -25,6 +25,9 @@ namespace final {
     struct T final : S {}; // expected-error {{base 'S' is marked 'final'}}
     struct T bar : S {}; // expected-error {{expected ';' after top level declarator}} expected-error {{expected unqualified-id}}
   }
+  // _Alignas isn't allowed in the places where alignas is. We used to
+  // assert on this.
+  struct U final _Alignas(4) {}; // expected-error 3{{}} expected-note {{}}
 }
 
 // enum versus bitfield mess.