diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 3bce8a87be2f76beccabbda107ce146920694597..64a3ef0debf3f47deb3cb03b9e56fb8abf897e69 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -616,12 +616,13 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd){ BalancedDelimiterTracker T(*this, tok::l_paren); if (T.consumeOpen()) { Diag(Tok, diag::err_expected_lparen); + SkipMalformedDecl(); return 0; } ExprResult AssertExpr(ParseConstantExpression()); if (AssertExpr.isInvalid()) { - SkipUntil(tok::semi); + SkipMalformedDecl(); return 0; } @@ -630,13 +631,13 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd){ if (!isTokenStringLiteral()) { Diag(Tok, diag::err_expected_string_literal); - SkipUntil(tok::semi); + SkipMalformedDecl(); return 0; } ExprResult AssertMessage(ParseStringLiteralExpression()); if (AssertMessage.isInvalid()) { - SkipUntil(tok::semi); + SkipMalformedDecl(); return 0; } diff --git a/clang/test/Parser/cxx0x-decl.cpp b/clang/test/Parser/cxx0x-decl.cpp index e97ba1ec90380a808018188948d71a73c5266e37..13c7fbf0b01371f332cfb2639f8e0e07eb28dd54 100644 --- a/clang/test/Parser/cxx0x-decl.cpp +++ b/clang/test/Parser/cxx0x-decl.cpp @@ -30,3 +30,5 @@ class ExtraSemiAfterMemFn { // pedantically warn on it int *const const p = 0; // expected-warning {{duplicate 'const' declaration specifier}} const const int *q = 0; // expected-warning {{duplicate 'const' declaration specifier}} + +static_assert(something, ""); // expected-error {{undeclared identifier}}