comparison gcc/testsuite/g++.dg/cpp2a/spaceship-eq1.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // { dg-do run { target c++2a } }
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 }