gcc/testsuite/g++.dg/cpp2a/spaceship-constexpr1.C
raw| 1 | // { dg-do compile { target c++20 } } |
| 2 | |
| 3 | struct A |
| 4 | { |
| 5 | int i; |
| 6 | bool operator==(A a) const { return i == a.i; } |
| 7 | }; |
| 8 | |
| 9 | struct B |
| 10 | { |
| 11 | A a; |
| 12 | bool operator==(const B&) const = default; // { dg-error "A::operator==" "" { target { { ! implicit_constexpr } && c++20_down } } } |
| 13 | }; |
| 14 | |
| 15 | constexpr bool x = B() == B(); // { dg-error "non-.constexpr" "" { target { ! implicit_constexpr } } } |