| 1 |
// PR c++/94907 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
namespace std { struct strong_ordering { |
| 5 |
int _v; |
| 6 |
constexpr strong_ordering (int v) :_v(v) {} |
| 7 |
constexpr operator int (void) const { return _v; } |
| 8 |
static const strong_ordering less; |
| 9 |
static const strong_ordering equal; |
| 10 |
static const strong_ordering greater; |
| 11 |
}; |
| 12 |
constexpr strong_ordering strong_ordering::less = -1; |
| 13 |
constexpr strong_ordering strong_ordering::equal = 0; |
| 14 |
constexpr strong_ordering strong_ordering::greater = 1; |
| 15 |
} |
| 16 |
|
| 17 |
struct E; |
| 18 |
struct D { |
| 19 |
virtual std::strong_ordering operator<=>(const struct E&) const = 0; |
| 20 |
}; |
| 21 |
struct E : D { // { dg-error "no match" } |
| 22 |
std::strong_ordering operator<=>(const E&) const override = default; // { dg-message "default" } |
| 23 |
}; |
| 24 |
|
| 25 |
auto x = E() <=> E(); // { dg-error "deleted" } |