[PATCH] D36101: Fix usage of right shift operator in fold expressions

Nicolas Lesser via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 19 08:42:58 PDT 2017


Rakete1111 updated this revision to Diff 115842.
Rakete1111 added a project: clang.
Rakete1111 added a comment.

Added the tests to the existing test file for fold operators that I didn't notice before :)


https://reviews.llvm.org/D36101

Files:
  lib/Parse/ParseExpr.cpp
  test/Parser/cxx1z-fold-expressions.cpp


Index: test/Parser/cxx1z-fold-expressions.cpp
===================================================================
--- test/Parser/cxx1z-fold-expressions.cpp
+++ test/Parser/cxx1z-fold-expressions.cpp
@@ -43,3 +43,8 @@
     (int)(undeclared_junk + ...) + // expected-error {{undeclared}}
     (int)(a + ...); // expected-error {{does not contain any unexpanded}}
 }
+
+// fold-operator can be '>' or '>>'.
+template<int ...N> bool greater_than() { return (N > ...); }
+template<int ...N> bool right_shift() { return (N >> ...); }
+
Index: lib/Parse/ParseExpr.cpp
===================================================================
--- lib/Parse/ParseExpr.cpp
+++ lib/Parse/ParseExpr.cpp
@@ -270,7 +270,7 @@
   return Level > prec::Unknown && Level != prec::Conditional;
 }
 static bool isFoldOperator(tok::TokenKind Kind) {
-  return isFoldOperator(getBinOpPrecedence(Kind, false, true));
+  return isFoldOperator(getBinOpPrecedence(Kind, true, true));
 }
 
 /// \brief Parse a binary expression that starts with \p LHS and has a


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36101.115842.patch
Type: text/x-patch
Size: 1029 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170919/39ed1f70/attachment.bin>


More information about the cfe-commits mailing list