]> granicus.if.org Git - clang/commitdiff
Fix decltype crash-on-invalid, if we don't find a matching ')' for an ill-formed
authorRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 27 Feb 2012 05:24:00 +0000 (05:24 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 27 Feb 2012 05:24:00 +0000 (05:24 +0000)
decltype expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151515 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDeclCXX.cpp
test/Parser/bracket-crash.cpp

index d798281f40f8ce4eacab82100354af628a7afa3e..3bf7005769edc9d1420fcfb1f0e7debb218a75ce 100644 (file)
@@ -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 ')'
index fd18e0e25fefd5d4ecd4f7dcc8e7778fb4748f9e..bcc6eabc6e99c7e6ddc97678b7fd4f3ea5e624d9 100644 (file)
@@ -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
 }
-