r175866 - Don't skip '_Alignas' when disambiguating 'final'. '_Alignas' can't appear here,
Richard Smith
richard-llvm at metafoo.co.uk
Thu Feb 21 22:46:23 PST 2013
Author: rsmith
Date: Fri Feb 22 00:46:23 2013
New Revision: 175866
URL: http://llvm.org/viewvc/llvm-project?rev=175866&view=rev
Log:
Don't skip '_Alignas' when disambiguating 'final'. '_Alignas' can't appear here,
and we used to assert if it did.
Modified:
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/test/Parser/cxx0x-ambig.cpp
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=175866&r1=175865&r2=175866&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Fri Feb 22 00:46:23 2013
@@ -1293,9 +1293,8 @@ void Parser::ParseClassSpecifier(tok::To
// 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::To
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::To
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);
Modified: cfe/trunk/test/Parser/cxx0x-ambig.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-ambig.cpp?rev=175866&r1=175865&r2=175866&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx0x-ambig.cpp (original)
+++ cfe/trunk/test/Parser/cxx0x-ambig.cpp Fri Feb 22 00:46:23 2013
@@ -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.
More information about the cfe-commits
mailing list