c++: prev declared hidden tmpl friend inst [PR112288]
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / spaceship-synth10.C
blob235e0020caf25f82c57d4c189724de23ce011723
1 // { dg-do run { target c++20 } }
2 // { dg-options "" }
4 #include <compare>
6 struct C {
7   int y;
8   int x[4];
9   auto operator<=>(C const&) const = default;
12 struct D {
13   int y;
14   int x[1];
15   auto operator<=>(D const&) const = default;
18 struct E {
19   int y;
20   int x[0];
21   auto operator<=>(E const&) const = default;
24 int
25 main ()
27   constexpr C c1 = { 1, { 2, 3, 4, 5 } };
28   constexpr C c2 = { 1, { 2, 3, 5, 4 } };
29   constexpr C c3 = { 1, { 2, 2, 6, 7 } };
30   static_assert (c1 < c2);
31   static_assert (c3 < c1);
32   constexpr D d1 = { 1, { 2 } };
33   constexpr D d2 = { 1, { 3 } };
34   constexpr D d3 = { 1, { 1 } };
35   static_assert (d1 < d2);
36   static_assert (d3 < d1);
37   constexpr E e1 = { 1, {} };
38   constexpr E e2 = { 2, {} };
39   constexpr E e3 = { 1, {} };
40   static_assert (e1 < e2);
41   static_assert (e1 == e3);
42   C c4 = { 1, { 2, 3, 4, 5 } };
43   C c5 = { 1, { 2, 3, 5, 4 } };
44   C c6 = { 1, { 2, 2, 6, 7 } };
45   if (c4 >= c5 || c6 >= c4)
46     __builtin_abort ();
47   D d4 = { 1, { 2 } };
48   D d5 = { 1, { 3 } };
49   D d6 = { 1, { 1 } };
50   if (d4 >= d5 || d6 >= d4)
51     __builtin_abort ();
52   E e4 = { 1, {} };
53   E e5 = { 2, {} };
54   E e6 = { 1, {} };
55   if (e4 >= e5 || e4 != e6)
56     __builtin_abort ();