This is rejected because std::packaged_task uses std::function internally and std::function requires a CopyConstructible target object: #include <future> struct S { S() = default; S(S&&) = default; void operator()() { } }; std::packaged_task<void ()> pt{ S{} }; It's not necessary to use std::function, the _Task_state type could hold the stored task directly, which would allow it to be move constructed.
mine
Created attachment 29600 [details] Patch for after trunk reopens for 4.9
Author: redi Date: Sat Mar 16 02:48:06 2013 New Revision: 196695 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196695 Log: PR libstdc++/56492 * include/std/future (__future_base::_Result): Add result_type typedef. (__future_base::_S_allocate_result): Overload for std::allocator. (__future_base::_Task_setter): Use _Result::result_type instead of deducing the type from the task. (__future_base::_Task_state): Store allocator to allow shared state to be reset. Replace std::function with member of target object type accessed via ... (__future_base::_Task_state_base): New abstract base class. (__future_base::_Task_state_base::_M_run): New virtual function to invoke type-erased target object. (__future_base::_Task_state_base::_M_reset): New virtual function to create new shared_state using same target object and allocator. (__future_base::__create_task_state): Allocate a new _Task_state. (packaged_task::packaged_task): Use __create_task_state. (packaged_task::reset): Use _Task_state_base::_M_reset. * testsuite/30_threads/packaged_task/cons/56492.cc: New. Added: trunk/libstdc++-v3/testsuite/30_threads/packaged_task/cons/56492.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/std/future
fixed