From: Richard Smith Date: Mon, 27 Feb 2012 05:24:00 +0000 (+0000) Subject: Fix decltype crash-on-invalid, if we don't find a matching ')' for an ill-formed X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8e4daca4a44d25a9c09d51def9e3d485d4f302c;p=clang Fix decltype crash-on-invalid, if we don't find a matching ')' for an ill-formed decltype expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151515 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index d798281f40..3bf7005769 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -674,9 +674,9 @@ SourceLocation Parser::ParseDecltypeSpecifier(DeclSpec &DS) { 0, /*IsDecltype=*/true); Result = ParseExpression(); if (Result.isInvalid()) { - SkipUntil(tok::r_paren, true, true); + SkipUntil(tok::r_paren); DS.SetTypeSpecError(); - return Tok.is(tok::eof) ? Tok.getLocation() : ConsumeParen(); + return StartLoc; } // Match the ')' diff --git a/test/Parser/bracket-crash.cpp b/test/Parser/bracket-crash.cpp index fd18e0e25f..bcc6eabc6e 100644 --- a/test/Parser/bracket-crash.cpp +++ b/test/Parser/bracket-crash.cpp @@ -1,6 +1,6 @@ -// RUN: not %clang_cc1 -fsyntax-only %s +// RUN: not %clang_cc1 -fsyntax-only -std=c++11 %s // PR7481 +decltype(; struct{ a } -