summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/overloaded-operator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX/overloaded-operator.cpp')
-rw-r--r--clang/test/SemaCXX/overloaded-operator.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/overloaded-operator.cpp b/clang/test/SemaCXX/overloaded-operator.cpp
index 52d31c0ba07..71d949d750a 100644
--- a/clang/test/SemaCXX/overloaded-operator.cpp
+++ b/clang/test/SemaCXX/overloaded-operator.cpp
@@ -27,4 +27,24 @@ void g(Y y, Z z) {
bool b = y - z; // expected-error{{use of overloaded operator '-' is ambiguous; candidates are:}}
}
+struct A {
+ bool operator==(Z&); // expected-note{{candidate function}}
+};
+
+A make_A();
+bool operator==(A&, Z&); // expected-note{{candidate function}}
+
+void h(A a, const A ac, Z z) {
+ make_A() == z;
+ a == z; // expected-error{{use of overloaded operator '==' is ambiguous; candidates are:}}
+ ac == z; // expected-error{{invalid operands to binary expression ('struct A const' and 'struct Z')}}
+}
+
+struct B {
+ bool operator==(const B&) const;
+
+ void test(Z z) {
+ make_A() == z;
+ }
+};
OpenPOWER on IntegriCloud