gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg4.C
raw| 1 | // P2002: deleted if a subobject <=> has non-category type. |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | #include <compare> |
| 5 | |
| 6 | struct A |
| 7 | { |
| 8 | bool operator<=>(const A&) const; |
| 9 | }; |
| 10 | |
| 11 | struct B |
| 12 | { |
| 13 | A a; // { dg-message "bool" } |
| 14 | auto operator<=>(const B&) const = default; |
| 15 | }; |
| 16 | |
| 17 | int main() |
| 18 | { |
| 19 | auto x = B() <=> B(); // { dg-error "deleted" } |
| 20 | } |