The problem is that packaged_task uses an allocator to allocate memory for the packaged_task. If you don't pass it one, it uses std::allocator<function_type>. That's fine for functors in general, and function pointers, but not for actual functions. You can't create a std::allocator<void(int)>.
What I've done here is add a call to decay<> on the function type. This has no effect for structs, nor std::function, nor lambdas, etc, but a function will decay to a function pointer, which we can instantiate and allocator for.