Boost logo

Boost Users :

Subject: Re: [Boost-users] [thread] Internal compiler error when trying to make movable future
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-09-07 03:47:35


Le 06/09/13 04:54, Gavin Lambert a écrit :
> Am I doing something wrong in the following code?
>
> #include <boost/thread/future.hpp>
>
> template<typename T>
> struct test_node
> {
> BOOST_THREAD_MOVABLE_ONLY(test_node)
>
> typedef boost::unique_future<test_node> future_node;
>
> T value;
> future_node next;
> };
>
> (In the "real code" I've defined move constructors etc as well of
> course, but they don't affect the result so I've omitted them for
> brevity.)
>
> Using boost v1.53 with BOOST_THREAD_VERSION==2 and VS2008 (non C++11
> compiler), the above code produces an internal compiler error:
>
> 1>t:\boost\boost_1_53_0\boost\type_traits\is_convertible.hpp(484) :
> fatal error C1001: An internal error has occurred in the compiler.
> 1>(compiler file 'msc1.cpp', line 1411)
> 1> To work around this problem, try simplifying or changing the
> program near the locations listed above.
> 1>Please choose the Technical Support command on the Visual C++
> 1> Help menu, or open the Technical Support help file for more
> information
> 1> t:\boost\boost_1_53_0\boost\thread\detail\is_convertible.hpp(22) :
> see reference to class template instantiation
> 'boost::is_convertible<From,To>' being compiled
> 1> with
> 1> [
> 1> From=test_node<int> &,
> 1> To=boost::detail::thread_move_t<test_node<int>>
> 1> ]
> 1> t:\boost\boost_1_53_0\boost\mpl\if.hpp(63) : see reference
> to class template instantiation
> 'boost::thread_detail::is_convertible<T1,T2>' being compiled
> 1> with
> 1> [
> 1> T1=test_node<int> &,
> 1> T2=boost::detail::thread_move_t<test_node<int>>
> 1> ]
> 1> t:\boost\boost_1_53_0\boost\thread\future.hpp(519) : see
> reference to class template instantiation 'boost::mpl::if_<T1,T2,T3>'
> being compiled
> 1> with
> 1> [
> 1> T1=boost::thread_detail::is_convertible<test_node<int>
> &,boost::detail::thread_move_t<test_node<int>>>,
> 1> T2=boost::detail::thread_move_t<test_node<int>>,
> 1> T3=const test_node<int> &
> 1> ]
> 1> t:\boost\boost_1_53_0\boost\thread\future.hpp(1398) : see
> reference to class template instantiation
> 'boost::detail::future_traits<T>' being compiled
> 1> with
> 1> [
> 1> T=test_node<int>
> 1> ]
> 1> s:\tests\nodetest.cpp(26) : see reference to class template
> instantiation 'boost::unique_future<R>' being compiled
> 1> with
> 1> [
> 1> R=test_node<int>
> 1> ]
> 1> s:\tests\nodetest.cpp(56) : see reference to class template
> instantiation 'test_node<T>' being compiled
> 1> with
> 1> [
> 1> T=int
> 1> ]
>
> The internal error goes away if I remove the MOVABLE_ONLY macro or the
> future_node instance field. The equivalent move code (using
> boost::detail::thread_move_t directly) for boost 1.47 compiles and
> works successfully (but crashes again if I switch to boost 1.53).
>
> Is this a regression in boost or am I doing something incorrect
> somewhere? Does anyone know of a workaround?
>
> Note that it does not matter if I try to use Boost.Move syntax
> instead, as unique_future<> internally uses Boost.Thread's move
> implementation, which is where things seem to be failing.
>
> One possible issue is that I'm trying to declare a future to an
> incomplete type (because it's self-referential), which is possibly
> confusing some of the internal checks it wants to do. But again, this
> usage used to work, and I'm not sure how to fix it given the new boost
> version. At least not without introducing pointers and heap
> allocation, which I really didn't want to do.
>
>
>
Hi,

please,could you post a complete example so that I can try to reproduce it.

best,
Vicente


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