1 // { dg-do compile { target c++20 } }
8 constexpr bool operator()(const int&& x
, const int&& y
) { return x
< y
; }
13 constexpr const int&& operator()(const int& x
) const { return std::move(x
); }
16 static_assert(std::indirect_strict_weak_order
<Comp
, std::projected
<const int*, Proj
>>);
18 static_assert(std::ranges::clamp(+1, 0, 2, Comp
{}, Proj
{}) == 1);
19 static_assert(std::ranges::clamp(-1, 0, 2, Comp
{}, Proj
{}) == 0);
20 static_assert(std::ranges::clamp(10, 0, 2, Comp
{}, Proj
{}) == 2);
23 // Testcase from PR118185
27 constexpr bool operator()(const int&& x
, const int&& y
) const { return x
< y
; }
28 constexpr bool operator()(const int&& x
, int& y
) const { return x
< y
; }
29 constexpr bool operator()(int& x
, const int&& y
) const { return x
< y
; }
30 constexpr bool operator()(int& x
, int& y
) const { return x
< y
; }
31 constexpr bool operator()(std::same_as
<const int&> auto && x
, std::same_as
<const int&> auto && y
) const
37 static_assert(std::indirect_strict_weak_order
<Comp2
, std::projected
<const int*, Proj
>>);
39 static_assert(std::ranges::clamp(+1, 0, 2, Comp2
{}, Proj
{}) == 1);
40 static_assert(std::ranges::clamp(-1, 0, 2, Comp2
{}, Proj
{}) == 0);
41 static_assert(std::ranges::clamp(10, 0, 2, Comp2
{}, Proj
{}) == 2);