1 // { dg-do compile { target c++23 } }
2 // { dg-require-effective-target hosted }
6 template<typename T
, typename U
> struct require_same
;
7 template<typename T
> struct require_same
<T
, T
> { using type
= void; };
9 template<typename T
, typename U
>
10 typename require_same
<T
, U
>::type
14 test_static_call_operator()
16 struct F1
{ static long operator()() { return 0; } };
17 std::function func1
= F1
{};
18 check_type
<std::function
<long()>>(func1
);
20 struct F2
{ static float operator()(char, void*) noexcept
{ return 0; } };
21 std::function func2
= F2
{};
22 check_type
<std::function
<float(char, void*)>>(func2
);
26 test_explicit_object_call_operator()
28 // LWG 3617 - function/packaged_task deduction guides and deducing this
30 int operator()(this const F
&) { return 42; }
33 std::function g
= F
{};
34 check_type
<std::function
<int()>>(g
);
37 short operator()(this F2
&, float&) { return 0; }
40 std::function g2
= F2
{};
41 check_type
<std::function
<short(float&)>>(g2
);
44 void operator()(this const F3
, char*, long) { }
47 std::function g3
= F3
{};
48 check_type
<std::function
<void(char*, long)>>(g3
);
52 operator const int&() const { return i
; }
53 const long& operator()(this int, const long& l
) { return l
; }
56 std::function g4
= F4
{};
57 check_type
<std::function
<const long&(const long&)>>(g4
);