http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56492



             Bug #: 56492

           Summary: std::packaged_task requires CopyConstructible stored

                    task

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Keywords: rejects-valid

          Severity: normal

          Priority: P3

         Component: libstdc++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: r...@gcc.gnu.org





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.

Reply via email to