Boost logo

Boost Users :

Subject: Re: [Boost-users] [Thread] 1.53 fails to compile working code
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2013-02-08 01:40:36


On Thu, Feb 7, 2013 at 11:17 AM, Szymon Gatner <szymon.gatner_at_[hidden]>wrote:

> Hello,
>
> following minimal code compiles fine with 1.52 and
> BOOST_THREAD_VERSION defined to 3 but gives compilation error with
> 1.53 release (Visual Studio 2008 SP1, Win 7):
>
> #include <boost/move/move.hpp>
> #include <boost/thread/future.hpp>
>
> class Dummy
> {
> public:
>
> Dummy& operator=(BOOST_RV_REF(Dummy) other);
>
> Dummy& operator=(BOOST_COPY_ASSIGN_REF(Dummy) other);
>
> BOOST_COPYABLE_AND_MOVABLE(Dummy);
> };
>
> Dummy createDummy();
>
> int main()
> {
> boost::future<Dummy> df = boost::async(&createDummy);
> }
>
> Error message:
>
> 1>------ Build started: Project: boost_153_test, Configuration: Debug
> Win32 ------
> 1>Compiling...
> 1>main.cpp
> 1>c:\devel\boost_1_53_0\boost\thread\future.hpp(661) : error C2665:
> 'boost::detail::future_traits<T>::init' : none of the 2 overloads
> could convert all the argument types
> 1> with
> 1> [
> 1> T=Dummy
> 1> ]
> 1> c:\devel\boost_1_53_0\boost\thread\future.hpp(525): could be
> 'void boost::detail::future_traits<T>::init(boost::scoped_ptr<T>
> &,Dummy &)'
> 1> with
> 1> [
> 1> T=Dummy
> 1> ]
> 1> c:\devel\boost_1_53_0\boost\thread\future.hpp(530): or
> 'void boost::detail::future_traits<T>::init(boost::scoped_ptr<T>
> &,boost::rv<T> &)'
> 1> with
> 1> [
> 1> T=Dummy
> 1> ]
> 1> while trying to match the argument list
>

This looks like an error in the future_traits<T>::init overload set...it's
missing an overload that a T const & can bind to (in the second argument).

Also, I think it would be an improvement if set_value_at_thread_exit was
able to catch rvalues as emulated rvalue references (when true rvalue
references are unavailable) rather than as lvalue-reference-to-const.

- Jeff



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net