| 1 |
// PR c++/104392 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
namespace std { |
| 5 |
struct strong_ordering { |
| 6 |
int _v; |
| 7 |
constexpr strong_ordering (int v) :_v(v) {} |
| 8 |
constexpr operator int (void) const { return _v; } |
| 9 |
static const strong_ordering less; |
| 10 |
static const strong_ordering equal; |
| 11 |
static const strong_ordering greater; |
| 12 |
}; |
| 13 |
constexpr strong_ordering strong_ordering::less = -1; |
| 14 |
constexpr strong_ordering strong_ordering::equal = 0; |
| 15 |
constexpr strong_ordering strong_ordering::greater = 1; |
| 16 |
} |
| 17 |
|
| 18 |
struct A { |
| 19 |
unsigned int a:5; |
| 20 |
}; |
| 21 |
|
| 22 |
constexpr std::strong_ordering |
| 23 |
operator<=>(const A & left, const A & right) |
| 24 |
{ |
| 25 |
return left.a <=> right.a; |
| 26 |
} |