gcc/testsuite/g++.dg/cpp2a/spaceship-synth12.C
raw| 1 | // PR c++/98712 |
| 2 | // { dg-do run { target c++20 } } |
| 3 | |
| 4 | #include <compare> |
| 5 | |
| 6 | struct S |
| 7 | { |
| 8 | int s = 0; |
| 9 | S(int s) : s(s) {} |
| 10 | auto operator<=>(const S&) const = default; |
| 11 | }; |
| 12 | |
| 13 | struct T : S |
| 14 | { |
| 15 | T(int s) : S(s) {} |
| 16 | constexpr auto operator<=>(const T&) const = default; |
| 17 | }; |
| 18 | |
| 19 | int |
| 20 | main() |
| 21 | { |
| 22 | if (T(0) >= T(1)) |
| 23 | __builtin_abort (); |
| 24 | } |