Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/spaceship-eq1.C

raw
1 // { dg-do run { 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 #define assert(X) do { if (!(X)) __builtin_abort(); } while (0)
11
12 int main()
13 {
14 D d{42};
15 assert (d == d);
16 assert (!(d != d));
17 }