Debian Codegraph @

gcc/testsuite/g++.dg/lookup/operator-8.C

raw
1 // Verify phase 1 lookup works properly for rewritten non-dependent conditional
2 // operator expressions.
3
4 // This test currently fails due to build_min_non_dep_op_overload not knowing
5 // how to handle rewritten operator expressions; see the FIXME in build_new_op.
6
7 // { dg-do compile { target c++20 } }
8
9 #include <compare>
10
11 struct A {
12 bool operator==(int);
13 std::strong_ordering operator<=>(int);
14 };
15
16 template<class T>
17 void f() {
18 A a;
19 (void)(a != 0, 0 != a); // { dg-bogus "deleted" "" { xfail *-*-* } }
20 (void)(a < 0, 0 < a); // { dg-bogus "deleted" "" { xfail *-*-* } }
21 (void)(a <= 0, 0 <= a); // { dg-bogus "deleted" "" { xfail *-*-* } }
22 (void)(a > 0, 0 > a); // { dg-bogus "deleted" "" { xfail *-*-* } }
23 (void)(a >= 0, 0 >= a); // { dg-bogus "deleted" "" { xfail *-*-* } }
24 }
25
26 // These later-declared namespace-scope overloads shouldn't be considered
27 // when instantiating f<int>.
28 bool operator!=(A, int) = delete;
29 bool operator<(A, int) = delete;
30 bool operator<=(A, int) = delete;
31 bool operator>(A, int) = delete;
32 bool operator>=(A, int) = delete;
33
34 template void f<int>();