aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaExpr.cpp3
-rw-r--r--test/Sema/parentheses.cpp12
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 62bfa3c709..75da99c344 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -5412,7 +5412,8 @@ static bool IsArithmeticBinaryExpr(Expr *E, BinaryOperatorKind *Opcode,
// Make sure this is really a binary operator that is safe to pass into
// BinaryOperator::getOverloadedOpcode(), e.g. it's not a subscript op.
OverloadedOperatorKind OO = Call->getOperator();
- if (OO < OO_Plus || OO > OO_Arrow)
+ if (OO < OO_Plus || OO > OO_Arrow ||
+ OO == OO_PlusPlus || OO == OO_MinusMinus)
return false;
BinaryOperatorKind OpKind = BinaryOperator::getOverloadedOpcode(OO);
diff --git a/test/Sema/parentheses.cpp b/test/Sema/parentheses.cpp
index 8f5f24652d..da37dd397b 100644
--- a/test/Sema/parentheses.cpp
+++ b/test/Sema/parentheses.cpp
@@ -57,3 +57,15 @@ void test(int a, int b, int c) {
Stream() >> b + c; // expected-warning {{operator '>>' has lower precedence than '+'; '+' will be evaluated first}} \
expected-note {{place parentheses around the '+' expression to silence this warning}}
}
+
+namespace PR15628 {
+ struct BlockInputIter {
+ void* operator++(int);
+ void* operator--(int);
+ };
+
+ void test(BlockInputIter i) {
+ (void)(i++ ? true : false); // no-warning
+ (void)(i-- ? true : false); // no-warning
+ }
+}