Debian Codegraph @

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

raw
1 // { dg-do run { target c++20 } }
2
3 template <class T>
4 struct D
5 {
6 T i;
7 bool operator==(const D& x) const = default; // OK, returns x.i == y.i
8 bool operator!=(const D& z) const = default; // OK, returns !(*this == z)
9 };
10
11 #define assert(X) do { if (!(X)) __builtin_abort(); } while (0)
12
13 template <class T>
14 void f()
15 {
16 D<T> d{42};
17 assert (d == d);
18 assert (!(d != d));
19 }
20
21 int main()
22 {
23 f<int>();
24 }