gcc/testsuite/g++.dg/cpp2a/spaceship-eq2.C
raw| 1 | // { dg-do compile { target c++20 } } |
| 2 | |
| 3 | struct D |
| 4 | { |
| 5 | int i; |
| 6 | bool operator==(const D& x) const = default; // OK, returns x.i == y.i |
| 7 | bool operator!=(const D& z) const = default; // OK, returns !(*this == z) |
| 8 | }; |
| 9 | |
| 10 | constexpr D d{42}; |
| 11 | static_assert (d == d); |
| 12 | static_assert (!(d != d)); |