// { dg-do compile { target c++23 } } #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::packaged_task task1{ F1{} }; check_type>(task1); struct F2 { static float operator()(char, void*) noexcept { return 0; } }; std::packaged_task task2{ F2{} }; check_type>(task2); } 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::packaged_task g{ F{} }; check_type>(g); struct F2 { short operator()(this F2&, float&) { return 0; } }; std::packaged_task g2{ F2{} }; check_type>(g2); struct F3 { void operator()(this const F3, char*, long) { } }; std::packaged_task 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::packaged_task g4{ F4{} }; check_type>(g4); }