gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg2.C
raw| 1 | // PR c++/92774 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | #include <compare> |
| 5 | |
| 6 | template<typename T> |
| 7 | struct X { }; |
| 8 | |
| 9 | template<typename T> |
| 10 | bool operator==(const X<T>&, const X<T>&) { return true; } |
| 11 | template<typename T> |
| 12 | bool operator<(const X<T>&, const X<T>&) { return true; } |
| 13 | |
| 14 | struct Y |
| 15 | { |
| 16 | int a; |
| 17 | X<int> c; // { dg-error "no match" } |
| 18 | |
| 19 | auto operator <=>(Y const&) const = default; |
| 20 | }; |
| 21 | |
| 22 | void f() |
| 23 | { |
| 24 | auto x = Y() < Y(); // { dg-error "deleted" } |
| 25 | } |