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
8 // Mock how STD defined unspecified parameters for the operators below.
9 struct _CmpUnspecifiedParam
{
11 _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept
{}
14 struct strong_ordering
{
17 friend constexpr bool operator==(strong_ordering v
,
18 _CmpUnspecifiedParam
) noexcept
{
21 friend constexpr bool operator<(strong_ordering v
,
22 _CmpUnspecifiedParam
) noexcept
{
25 friend constexpr bool operator>(strong_ordering v
,
26 _CmpUnspecifiedParam
) noexcept
{
29 friend constexpr bool operator>=(strong_ordering v
,
30 _CmpUnspecifiedParam
) noexcept
{
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};
41 friend bool operator<(const S
&, const S
&);
42 friend bool operator==(const S
&, const S
&);
46 friend bool operator==(MyStruct
const& lhs
, MyStruct
const& rhs
) = delete;
47 friend std::strong_ordering
operator<=>(MyStruct
const& lhs
, MyStruct
const& rhs
) = default;
51 void foo(MyStruct bar
){