title: std::function and std::packaged_task conversion
body: <p>I am trying to move a <code>std::packaged_task</code> into a <code>std::vector</code> of <code>std::function&lt;void()&gt;</code>, because <code>std::packaged_task</code> has <code>void operator()( ArgTypes... args )</code> overloaded, it should be convertable to <code>std::function&lt;void()&gt;</code>, yes?  </p>
  
  <p>This doesnt compile both on MSVC and Clang, MSVC complains about cannot convert void to int, clang complains deleted copy constructor for <code>std::packaged_task</code>, shouldn't move version of <code>std::vector::push_back</code> be called here? what is going on, is this a bug?</p>
  
  <pre><code>int main () 
  {
      std::vector&lt;std::function&lt;void()&gt;&gt; vec;
      std::packaged_task&lt;int()&gt; task( [] { return 100; } );
      vec.push_back( std::move(task) );
  }
  </code></pre>
  
  <p>Here is the cryptic template error messages for clang</p>
  
  <pre><code>In file included from main.cpp:1:
  In file included from /usr/bin/../lib/c++/v1/iostream:38:
  In file included from /usr/bin/../lib/c++/v1/ios:216:
  In file included from /usr/bin/../lib/c++/v1/__locale:15:
  In file included from /usr/bin/../lib/c++/v1/string:434:
  In file included from /usr/bin/../lib/c++/v1/algorithm:594:
  /usr/bin/../lib/c++/v1/memory:2236:15: error: call to deleted constructor of
        'std::__1::packaged_task&lt;int ()&gt;'
                __first_(_VSTD::forward&lt;_Args1&gt;(get&lt;_I1&gt;(__first_args))...)
                ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/bin/../lib/c++/v1/memory:2414:15: note: in instantiation of function
        template specialization
        'std::__1::__libcpp_compressed_pair_imp&lt;std::__1::packaged_task&lt;int ()&gt;,
        std::__1::allocator&lt;std::__1::packaged_task&lt;int ()&gt; &gt;,
        2&gt;::__libcpp_compressed_pair_imp&lt;const std::__1::packaged_task&lt;int ()&gt; &amp;,
        const std::__1::allocator&lt;std::__1::packaged_task&lt;int ()&gt; &gt; &amp;, 0, 0&gt;'
        requested here
              : base(__pc, _VSTD::move(__first_args), _VSTD::move(__second_args),
                ^
  /usr/bin/../lib/c++/v1/functional:996:11: note: in instantiation of function
        template specialization
        'std::__1::__compressed_pair&lt;std::__1::packaged_task&lt;int ()&gt;,
        std::__1::allocator&lt;std::__1::packaged_task&lt;int ()&gt; &gt;
        &gt;::__compressed_pair&lt;const std::__1::packaged_task&lt;int ()&gt; &amp;, const
        std::__1::allocator&lt;std::__1::packaged_task&lt;int ()&gt; &gt; &amp;&gt;' requested here
          : __f_(piecewise_construct, _VSTD::forward_as_tuple(__f),
            ^
  /usr/bin/../lib/c++/v1/functional:1035:17: note: in instantiation of member
        function 'std::__1::__function::__func&lt;std::__1::packaged_task&lt;int ()&gt;,
        std::__1::allocator&lt;std::__1::packaged_task&lt;int ()&gt; &gt;, void ()&gt;::__func'
        requested here
      ::new (__p) __func(__f_.first(), __f_.second());
                  ^
  /usr/bin/../lib/c++/v1/functional:1277:26: note: in instantiation of member
        function 'std::__1::__function::__func&lt;std::__1::packaged_task&lt;int ()&gt;,
        std::__1::allocator&lt;std::__1::packaged_task&lt;int ()&gt; &gt;, void ()&gt;::__clone'
        requested here
              ::new (__f_) _FF(_VSTD::move(__f));
                           ^
  /usr/bin/../lib/c++/v1/memory:1681:31: note: in instantiation of function
        template specialization 'std::__1::function&lt;void
        ()&gt;::function&lt;std::__1::packaged_task&lt;int ()&gt; &gt;' requested here
              ::new((void*)__p) _Up(_VSTD::forward&lt;_Args&gt;(__args)...);
                                ^
  /usr/bin/../lib/c++/v1/memory:1608:18: note: in instantiation of function
        template specialization 'std::__1::allocator&lt;std::__1::function&lt;void ()&gt;
        &gt;::construct&lt;std::__1::function&lt;void ()&gt;, std::__1::packaged_task&lt;int ()&gt;
        &gt;' requested here
              {__a.construct(__p, _VSTD::forward&lt;_Args&gt;(__args)...);}
                   ^
  /usr/bin/../lib/c++/v1/memory:1492:14: note: in instantiation of function
        template specialization
        'std::__1::allocator_traits&lt;std::__1::allocator&lt;std::__1::function&lt;void
        ()&gt; &gt; &gt;::__construct&lt;std::__1::function&lt;void ()&gt;,
        std::__1::packaged_task&lt;int ()&gt; &gt;' requested here
              {__construct(__has_construct&lt;allocator_type, pointer, _Args...&gt;(),
               ^
  /usr/bin/../lib/c++/v1/vector:1519:25: note: in instantiation of function
        template specialization
        'std::__1::allocator_traits&lt;std::__1::allocator&lt;std::__1::function&lt;void
        ()&gt; &gt; &gt;::construct&lt;std::__1::function&lt;void ()&gt;,
        std::__1::packaged_task&lt;int ()&gt; &gt;' requested here
          __alloc_traits::construct(this-&gt;__alloc(),
                          ^
  main.cpp:19:6: note: in instantiation of function template specialization
        'std::__1::vector&lt;std::__1::function&lt;void ()&gt;,
        std::__1::allocator&lt;std::__1::function&lt;void ()&gt; &gt;
        &gt;::emplace_back&lt;std::__1::packaged_task&lt;int ()&gt; &gt;' requested here
          vec.emplace_back( std::move(task) );
              ^
  /usr/bin/../lib/c++/v1/future:1956:5: note: function has been explicitly marked
        deleted here
      packaged_task(const packaged_task&amp;) = delete;
      ^
  2 errors generated.
  </code></pre>