[OpenACC] Enable 'attach' clause for combined constructs
[llvm-project.git] / clang / test / CoverageMapping / strong_order.cpp
blobeeed85f826069f7b671c17665923c061a38df257
1 // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++23 -triple %itanium_abi_triple -main-file-name if.cpp %s
3 // No crash for following example.
4 // See https://github.com/llvm/llvm-project/issues/45481
5 namespace std {
6 class strong_ordering;
8 // Mock how STD defined unspecified parameters for the operators below.
9 struct _CmpUnspecifiedParam {
10 consteval
11 _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {}
14 struct strong_ordering {
15 signed char value;
17 friend constexpr bool operator==(strong_ordering v,
18 _CmpUnspecifiedParam) noexcept {
19 return v.value == 0;
21 friend constexpr bool operator<(strong_ordering v,
22 _CmpUnspecifiedParam) noexcept {
23 return v.value < 0;
25 friend constexpr bool operator>(strong_ordering v,
26 _CmpUnspecifiedParam) noexcept {
27 return v.value > 0;
29 friend constexpr bool operator>=(strong_ordering v,
30 _CmpUnspecifiedParam) noexcept {
31 return v.value >= 0;
33 static const strong_ordering equal, greater, less;
35 constexpr strong_ordering strong_ordering::equal = {0};
36 constexpr strong_ordering strong_ordering::greater = {1};
37 constexpr strong_ordering strong_ordering::less = {-1};
38 } // namespace std
40 struct S {
41 friend bool operator<(const S&, const S&);
42 friend bool operator==(const S&, const S&);
45 struct MyStruct {
46 friend bool operator==(MyStruct const& lhs, MyStruct const& rhs) = delete;
47 friend std::strong_ordering operator<=>(MyStruct const& lhs, MyStruct const& rhs) = default;
48 S value;
51 void foo(MyStruct bar){
52 (void)(bar <=> bar);