Martin =?utf-8?q?Bednár?= <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>
================
@@ -90,3 +91,148 @@ void func(void) {
// CHECK: CompoundAssignOperator=^= BinOp=^= 31
// CHECK: CompoundAssignOperator=|= BinOp=|= 32
// CHECK: BinaryOperator=, BinOp=, 33
+
+struct D {
+ D() = default;
+ D& operator+(){return *this;}
+ D& operator-(){return *this;}
+ D& operator*(const D&){return *this;}
+ D& operator/(const D&){return *this;}
+ D& operator%(const D&){return *this;}
+ D& operator+(const D&){return *this;}
+ D& operator-(const D&){return *this;}
+
+ D& operator<<(const D&){return *this;}
+ D& operator>>(const D&){return *this;}
+
+ bool operator<(const D&){return true;}
+ bool operator>(const D&){return true;}
+ bool operator<=(const D&){return true;}
+ bool operator>=(const D&){return true;}
+ bool operator==(const D&){return true;}
+ bool operator!=(const D&){return true;}
+
+ D& operator|(const D&){return *this;}
+ D& operator&(const D&){return *this;}
+ D& operator^(const D&){return *this;}
+
+ bool operator&&(const D&){return true;}
+ bool operator||(const D&){return true;}
+
+ D& operator+=(const D&){return *this;}
+ D& operator-=(const D&){return *this;}
+ D& operator*=(const D&){return *this;}
+ D& operator/=(const D&){return *this;}
+ D& operator%=(const D&){return *this;}
+ D& operator&=(const D&){return *this;}
+ D& operator|=(const D&){return *this;}
+ D& operator^=(const D&){return *this;}
+ D& operator<<=(const D&){return *this;}
+ D& operator>>=(const D&){return *this;}
+ D& operator,(const D&){return *this;}
+
+ int& operator->*(int D::*i){return this->i;}
+
+ // Negative test of --/++
+ D& operator++(){return *this;};
+ D& operator++(int){return *this;};
+ D& operator--(){return *this;};
+ D& operator--(int){return *this;};
+
+ int i;
+};
+
+void func2(void) {
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wunused-value"
+ D a, b;
+ int D::*p = &D::i;
+
+ D *pc;
+ a->*p;
+
+ a *b;
+ a / b;
+ a % b;
+ a + b;
+ a - b;
+
+ a << b;
+ a >> b;
+
+ a < b;
+ a > b;
+
+ a <= b;
+ a >= b;
+ a == b;
+ a != b;
+
+ a &b;
+ a ^ b;
+ a | b;
+
+ a &&b;
+ a || b;
+
+ a = b;
+
+ a *= b;
+ a /= b;
+ a %= b;
+ a += b;
+ a -= b;
+
+ a <<= b;
+ a >>= b;
+
+ a &= b;
+ a ^= b;
+ a |= b;
+ a, b;
+
+// Negative test
+ a++;
+ ++a;
+ a--;
+ --a;
+ #pragma clang diagnostic pop
+}
+
+// CHECK: CallExpr=D:96:3 BinOp= 0
+// CHECK: CallExpr=D:96:3 BinOp= 0
+// CHECK: CallExpr=operator->*:134:8 BinOp=->* 2
+// CHECK: CallExpr=operator*:99:6 BinOp=* 3
+// CHECK: CallExpr=operator/:100:6 BinOp=/ 4
----------------
AaronBallman wrote:
Are these emitted out of order? I'm surprised to see the line numbers jumping
around like this. Might be a bit easier to reason about if you use `CHECK-NEXT`
lines?
https://github.com/llvm/llvm-project/pull/182303
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits