[PATCH] D36101: Fix usage of right shift operator in fold expressions
Nicolas Lesser via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 21 11:32:23 PDT 2017
Rakete1111 updated this revision to Diff 119767.
Rakete1111 added a comment.
Used the naming convention of LLVM + friendly ping. :)
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 '>>' too.
+template<int ...N> bool greaterThan() { return (N > ...); }
+template<int ...N> int rightShift() { 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.119767.patch
Type: text/x-patch
Size: 1030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171021/76e936c0/attachment.bin>
More information about the cfe-commits
mailing list