]> granicus.if.org Git - clang/commitdiff
Properly parse a postfix expression following a Boolean literal. Fixes PR34273.
authorAaron Ballman <aaron@aaronballman.com>
Thu, 28 Sep 2017 21:29:18 +0000 (21:29 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Thu, 28 Sep 2017 21:29:18 +0000 (21:29 +0000)
Patch by Nicolas Lesser.

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

lib/Parse/ParseExpr.cpp
test/Parser/cxx-bool.cpp

index 60985633409c4a5b0461daf4a8157b0f7b577d24..5e0688ca58e307d90903affe7f6a0e3f3d9ac617 100644 (file)
@@ -798,7 +798,8 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
 
   case tok::kw_true:
   case tok::kw_false:
-    return ParseCXXBoolLiteral();
+    Res = ParseCXXBoolLiteral();
+    break;
   
   case tok::kw___objc_yes:
   case tok::kw___objc_no:
index a8a161edb105b5f54258fc11f2ca3f68a646ce8f..21591d10e9064f536243b33285f412f9a92772d1 100644 (file)
@@ -1,4 +1,11 @@
-// RUN: %clang_cc1 -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
 
 bool a = true;
 bool b = false;
+
+namespace pr34273 {
+  char c = "clang"[true];
+  char d = true["clang"];
+}
+