[PATCH] D38342: [C++] Parse (sub) postfix expression after boolean literal

Nicolas Lesser via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 28 14:08:11 PDT 2017


Rakete1111 updated this revision to Diff 117054.
Rakete1111 added a comment.

- Fixed test case for bools

Ah got it! Thanks!!


https://reviews.llvm.org/D38342

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


Index: test/Parser/cxx-bool.cpp
===================================================================
--- test/Parser/cxx-bool.cpp
+++ test/Parser/cxx-bool.cpp
@@ -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"];
+}
+
Index: lib/Parse/ParseExpr.cpp
===================================================================
--- lib/Parse/ParseExpr.cpp
+++ lib/Parse/ParseExpr.cpp
@@ -798,7 +798,8 @@
 
   case tok::kw_true:
   case tok::kw_false:
-    return ParseCXXBoolLiteral();
+    Res = ParseCXXBoolLiteral();
+    break;
   
   case tok::kw___objc_yes:
   case tok::kw___objc_no:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38342.117054.patch
Type: text/x-patch
Size: 764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170928/dea434d1/attachment-0001.bin>


More information about the cfe-commits mailing list