// { dg-do compile { target c++23 } } // { dg-require-effective-target hosted } #include template struct require_same; template struct require_same { using type = void; }; template typename require_same::type check_type(U&) { } void test_static_call_operator() { struct F1 { static long operator()() { return 0; } }; std::function func1 = F1{}; check_type>(func1); struct F2 { static float operator()(char, void*) noexcept { return 0; } }; std::function func2 = F2{}; check_type>(func2); } void test_explicit_object_call_operator() { // LWG 3617 - function/packaged_task deduction guides and deducing this struct F { int operator()(this const F&) { return 42; } }; std::function g = F{}; check_type>(g); struct F2 { short operator()(this F2&, float&) { return 0; } }; std::function g2 = F2{}; check_type>(g2); struct F3 { void operator()(this const F3, char*, long) { } }; std::function g3 = F3{}; check_type>(g3); struct F4 { int i; operator const int&() const { return i; } const long& operator()(this int, const long& l) { return l; } }; std::function g4 = F4{}; check_type>(g4); }