| 1 |
// RUN: %clang_cc1 --std=c++20 %s -emit-llvm -o - -triple x86_64-linux | FileCheck %s |
| 2 |
|
| 3 |
namespace std { |
| 4 |
struct strong_ordering { |
| 5 |
int n; |
| 6 |
constexpr operator int() const { return n; } |
| 7 |
static const strong_ordering equal, greater, less; |
| 8 |
}; |
| 9 |
constexpr inline strong_ordering strong_ordering::equal = {0}; |
| 10 |
constexpr inline strong_ordering strong_ordering::greater = {1}; |
| 11 |
constexpr inline strong_ordering strong_ordering::less = {-1}; |
| 12 |
} // namespace std |
| 13 |
|
| 14 |
struct Space { |
| 15 |
int i, j; |
| 16 |
|
| 17 |
std::strong_ordering operator<=>(Space const &other) const; |
| 18 |
bool operator==(Space const &other) const; |
| 19 |
}; |
| 20 |
|
| 21 |
// Make sure these cause emission |
| 22 |
std::strong_ordering Space::operator<=>(Space const &other) const = default; |
| 23 |
// CHECK-LABEL: define{{.*}} @_ZNK5SpacessERKS_ |
| 24 |
bool Space::operator==(Space const &) const = default; |
| 25 |
// CHECK-LABEL: define{{.*}} @_ZNK5SpaceeqERKS_ |
| 26 |
|
| 27 |
struct Water { |
| 28 |
int i, j; |
| 29 |
|
| 30 |
std::strong_ordering operator<=>(Water const &other) const; |
| 31 |
bool operator==(Water const &other) const; |
| 32 |
}; |
| 33 |
|
| 34 |
// Make sure these do not cause emission |
| 35 |
inline std::strong_ordering Water::operator<=>(Water const &other) const = default; |
| 36 |
// CHECK-NOT: define{{.*}} @_ZNK5WaterssERKS_ |
| 37 |
inline bool Water::operator==(Water const &) const = default; |
| 38 |
// CHECK-NOT: define{{.*}} @_ZNK5WatereqERKS_ |