]> granicus.if.org Git - clang/commitdiff
fix a buggy fall through that caused a crash-on-invalid. rdar://6248081
authorChris Lattner <sabre@nondot.org>
Fri, 12 Dec 2008 19:20:14 +0000 (19:20 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 12 Dec 2008 19:20:14 +0000 (19:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60961 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseExpr.cpp
test/Parser/recovery.c

index b18d5053649cf2a450ee8e1c02a3d9940becd171..0d324ecf71a901d4680a223f324fce145414f513 100644 (file)
@@ -644,16 +644,16 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
     SourceLocation AtLoc = ConsumeToken();
     return Owned(ParseObjCAtExpression(AtLoc));
   }
-  case tok::l_square:
-    // These can be followed by postfix-expr pieces.
-    if (getLang().ObjC1)
-      return ParsePostfixExpressionSuffix(Owned(ParseObjCMessageExpression()));
-    // FALL THROUGH.
   case tok::caret:
     if (getLang().Blocks)
       return ParsePostfixExpressionSuffix(Owned(ParseBlockLiteralExpression()));
     Diag(Tok, diag::err_expected_expression);
     return ExprError();
+  case tok::l_square:
+    // These can be followed by postfix-expr pieces.
+    if (getLang().ObjC1)
+      return ParsePostfixExpressionSuffix(Owned(ParseObjCMessageExpression()));
+    // FALL THROUGH.
   default:
   UnhandledToken:
     Diag(Tok, diag::err_expected_expression);
index ca9226037228941c0f431a8fd2881419b99b02d0..f77b570638264983e5555e850b50ae82911adff7 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -verify -pedantic %s
+// RUN: clang -fsyntax-only -verify -pedantic -fblocks %s
 
 // PR2241
 float test2241[] = { 
@@ -59,3 +59,9 @@ struct S { void *X, *Y; };
 struct S A = {
 &BADIDENT, 0     /* expected-error {{use of undeclared identifier}} */
 };
+
+// rdar://6248081
+int test6248081() { 
+  [10]  // expected-error {{expected expression}}
+}
+