brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 40f02ac Raw
39 lines · cpp
1// RUN: %clang_cc1 --std=c++20 %s -emit-llvm -o - -triple x86_64-linux | FileCheck %s2 3namespace std {4struct strong_ordering {5  int n;6  constexpr operator int() const { return n; }7  static const strong_ordering equal, greater, less;8};9constexpr inline strong_ordering strong_ordering::equal = {0};10constexpr inline strong_ordering strong_ordering::greater = {1};11constexpr inline strong_ordering strong_ordering::less = {-1};12} // namespace std13 14struct 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 emission22std::strong_ordering Space::operator<=>(Space const &other) const = default;23// CHECK-LABEL: define{{.*}} @_ZNK5SpacessERKS_24bool Space::operator==(Space const &) const = default;25// CHECK-LABEL: define{{.*}} @_ZNK5SpaceeqERKS_26 27struct 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 emission35inline std::strong_ordering Water::operator<=>(Water const &other) const = default;36// CHECK-NOT: define{{.*}} @_ZNK5WaterssERKS_37inline bool Water::operator==(Water const &) const = default;38// CHECK-NOT: define{{.*}} @_ZNK5WatereqERKS_39