|
Boost : |
Subject: Re: [boost] boost internal compile problems after moving to 1.44 in VC10
From: Christopher Lux (christopherlux_at_[hidden])
Date: 2010-08-18 10:08:25
Ok,
time to apologize. I just found this:
http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2008/n2812.html
an update to the rvalue references specification, which forbids
exactly what the error message says. This makes my previous rant null
and void. The compiler is more up to date.
So sorry..
And the fix for boost.interprocess is as easy as including the cast to
the return type (also proposed in the spec update above).
Regards
-chris
On Wed, Aug 18, 2010 at 3:51 PM, Christopher Lux
<christopherlux_at_[hidden]> wrote:
> 2010/8/17 Ion Gaztañaga <igaztanaga_at_[hidden]>:
>
>>> The errors especially are show stoppers here, i am not that into
>>> rvalue references yet to see the problems with the templates in
>>> boost.interprocess.
>>
>> Interprocess has not changed for this release, I had no time to update it
>> for the release (SVN head is updated though). VC10 is not still supported
>> (new move semantics are used by this compiler). You can try to disable
>> native rvalue references for this compiler in
>>
>> boost/interprocess/detail/move.hpp
>>
>> A quick fix is to replace BOOST_HAS_RVALUE_REFS in this header with another
>> non-existing macro.
>
> Hi,
> i dug into the move and rvalue issues and found the following:
>
> Everybody knows the following blog entry by Stephan T. Lavavej.
>
> http://blogs.msdn.com/b/vcblog/archive/2009/02/03/rvalue-references-c-0x-features-in-vc10-part-2.aspx
>
> In this post he has an example for move semantics etc. with the
> following move template:
>
> template <typename T> typename RemoveReference<T>::type&& Move(T&& t) {
> return t;
> }
>
> NOW. I implemented an example very similar to his and got the same
> error as in boost.interprocess:
>
> 1>e:\...\rvalue_ref_test\main.cpp(34): error C2440: 'return' : cannot
> convert from 'rv_test' to 'rv_test &&'
> 1> You cannot bind an lvalue to an rvalue reference
> 1> e:\...\rvalue_ref_test\main.cpp(51) : see reference to
> function template instantiation 'rv_test &&scm_move<rv_test&>(T)'
> being compiled
> 1> with
> 1> [
> 1> T=rv_test &
> 1> ]
>
>
> As i dug into the STL that comes with VC10 i found that they implement
> the move template as follows:
>
> template<class _Ty> inline typename
> tr1::_Remove_reference<_Ty>::_Type&& move(_Ty&& _Arg)
> {
> return ((typename tr1::_Remove_reference<_Ty>::_Type&&)_Arg);
> }
>
> NOW that works, and i am totally pissed off. Why do they publish blog
> posts with the correct way to handle it while their compiler requires
> a C-style cast in the move template function to get it working?
>
> Steven, i know you read in here. Is there an explanation for this?
>
> P.S. i attached my repo-example.
>
> Regards
> -chris
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk