Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6174: [thread] packaged_task does correctly handle moving results
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-03 15:23:43
#6174: [thread] packaged_task does correctly handle moving results
--------------------------------------+-------------------------------------
Reporter: onlyone@⦠| Owner: viboes
Type: Bugs | Status: assigned
Milestone: To Be Determined | Component: thread
Version: Boost Development Trunk | Severity: Showstopper
Resolution: | Keywords: move packaged_task
--------------------------------------+-------------------------------------
Comment (by onlyone@â¦):
Replying to [comment:2 viboes]:
> Please, could you stay with which compiler this doesn't compile and log
the compile error?
>
> I have no access to lambdas now. The following compiles for me with
clang
>
>
> {{{
>
boost::packaged_task<MovableButNonCopyable>(MovableButNonCopyable());
> }}}
>
Bizarre. I tried the following:
{{{
#include <boost/thread.hpp>
struct MovableButNonCopyable {
MovableButNonCopyable(){}
MovableButNonCopyable(MovableButNonCopyable&&){}
MovableButNonCopyable& operator=(MovableButNonCopyable&&){return
*this;}
private:
MovableButNonCopyable(MovableButNonCopyable const&);
MovableButNonCopyable& operator=(MovableButNonCopyable const&);
};
MovableButNonCopyable construct() {return MovableButNonCopyable();}
int main()
{
boost::packaged_task<MovableButNonCopyable>(construct);
}
}}}
And it compiles without issue with both Clang and GCC. However, the code
that I presented in the original ticket fails under GCC 4.6.2 (Macports
version, x86_64), with the following message:
{{{
In file included from
/Users/evan/Programming/boost/library/include/boost/thread.hpp:24:0,
from main.cpp:1:
/Users/evan/Programming/boost/library/include/boost/thread/future.hpp: In
static member function 'static void
boost::detail::future_traits<T>::init(boost::detail::future_traits<T>::storage_type&,
boost::detail::future_traits<T>::source_reference_type) [with T =
MovableButNonCopyable, boost::detail::future_traits<T>::storage_type =
boost::scoped_ptr<MovableButNonCopyable>,
boost::detail::future_traits<T>::source_reference_type = const
MovableButNonCopyable&]':
/Users/evan/Programming/boost/library/include/boost/thread/future.hpp:308:17:
instantiated from 'void
boost::detail::future_object<T>::mark_finished_with_result_internal(boost::detail::future_object<T>::source_reference_type)
[with T = MovableButNonCopyable,
boost::detail::future_object<T>::source_reference_type = const
MovableButNonCopyable&]'
/Users/evan/Programming/boost/library/include/boost/thread/future.hpp:325:17:
instantiated from 'void
boost::detail::future_object<T>::mark_finished_with_result(boost::detail::future_object<T>::rvalue_source_type)
[with T = MovableButNonCopyable,
boost::detail::future_object<T>::rvalue_source_type =
MovableButNonCopyable&&]'
/Users/evan/Programming/boost/library/include/boost/thread/future.hpp:1224:21:
instantiated from 'void boost::detail::task_object<R, F>::do_run() [with R
= MovableButNonCopyable, F = main()::<lambda()>]'
main.cpp:12:1: instantiated from here
/Users/evan/Programming/boost/library/include/boost/thread/future.hpp:239:17:
error: use of deleted function
'MovableButNonCopyable::MovableButNonCopyable(const
MovableButNonCopyable&)'
main.cpp:4:5: error: declared here
}}}
Unfortunately I do not have any other compilers that I can test it on
right at the moment. When I get the chance, I will try a few more versions
of GCC, Clang and MSVC. I will also see if I can find a way to reproduce
the bug without using lambdas or defaulted/deleted functions. (I will
report my findings some time this week).
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6174#comment:4> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC