gcc/testsuite/g++.dg/cpp2a/spaceship-scalar1-neg.C
raw| 1 | // { dg-do compile { target c++20 } } |
| 2 | |
| 3 | #include <compare> |
| 4 | |
| 5 | #define assert(X) do { if (!(X)) __builtin_abort(); } while(0) |
| 6 | |
| 7 | void f(){} |
| 8 | void g(){} |
| 9 | |
| 10 | int main() |
| 11 | { |
| 12 | { |
| 13 | const auto v = &f <=> &g; // { dg-error "invalid operands" } |
| 14 | } |
| 15 | |
| 16 | { |
| 17 | struct A { int i; int j; }; |
| 18 | constexpr auto v = &A::i <=> &A::j; // { dg-error "invalid operands" } |
| 19 | } |
| 20 | |
| 21 | { |
| 22 | struct A { void f(); }; |
| 23 | constexpr auto v = &A::f <=> &A::f; // { dg-error "invalid operands" } |
| 24 | } |
| 25 | } |