gcc/testsuite/g++.dg/cpp2a/spaceship-virtual1.C
raw| 1 | // PR c++/95567 |
| 2 | // { dg-do run { target c++20 } } |
| 3 | |
| 4 | struct B { |
| 5 | B(int i) : i(i) {} |
| 6 | virtual ~B() = default; |
| 7 | |
| 8 | bool operator==(B const&) const = default; |
| 9 | int i; |
| 10 | }; |
| 11 | |
| 12 | struct D : B { |
| 13 | D(int i, int j) : B(i), j(j) {} |
| 14 | int j; |
| 15 | }; |
| 16 | |
| 17 | int main() { |
| 18 | if (B(2) != D(2, 3)) |
| 19 | __builtin_abort(); |
| 20 | } |