boost internal compile problems after moving to 1.44 in VC10

Hi, i am in the process of moving my projects to boost 1.44 on VC10 x64. These are the problems i have (seems like all are boost internal): 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. 1>E...\inc\boost\boost/interprocess/detail/move.hpp(342): error C2440: 'return' : cannot convert from 'boost::interprocess::file_mapping' to 'boost::interprocess::file_mapping &&' 1> You cannot bind an lvalue to an rvalue reference 1> E...inc\boost\boost/interprocess/file_mapping.hpp(62) : see reference to function template instantiation 'boost::interprocess::file_mapping &&boost::interprocess::move<boost::interprocess::file_mapping&>(T)' being compiled 1> with 1> [ 1> T=boost::interprocess::file_mapping & 1> ] 1>E...\inc\boost\boost/interprocess/detail/move.hpp(342): error C2440: 'return' : cannot convert from 'boost::interprocess::mapped_region' to 'boost::interprocess::mapped_region &&' 1> You cannot bind an lvalue to an rvalue reference 1> E...\inc\boost\boost/interprocess/mapped_region.hpp(159) : see reference to function template instantiation 'boost::interprocess::mapped_region &&boost::interprocess::move<boost::interprocess::mapped_region&>(T)' being compiled 1> with 1> [ 1> T=boost::interprocess::mapped_region & 1> ] 1>E...\inc\boost\boost/thread/win32/thread_data.hpp(171): warning C4244: 'argument' : conversion from '__int64' to 'long', possible loss of data 1> ..\..\..\..\..\xxx.cpp(366) : see reference to function template instantiation 'void boost::this_thread::sleep<boost::date_time::subsecond_duration<base_duration,frac_of_second>>(const TimeDuration &)' being compiled 1> with 1> [ 1> base_duration=boost::posix_time::time_duration, 1> frac_of_second=0x03e8, 1> TimeDuration=boost::date_time::subsecond_duration<boost::posix_time::time_duration,0x03e8> 1> ] 1>E...\inc\boost\boost/interprocess/detail/os_file_functions.hpp(124): warning C4018: '>' : signed/unsigned mismatch

On 17/08/2010 19:01, Christopher Lux wrote:
Hi, i am in the process of moving my projects to boost 1.44 on VC10 x64. These are the problems i have (seems like all are boost internal):
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. Best, Ion

2010/8/17 Ion Gaztañaga <igaztanaga@gmail.com>:
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-fea... 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

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@gmail.com> wrote:
2010/8/17 Ion Gaztañaga <igaztanaga@gmail.com>:
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-fea...
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

I refer to this update as "rvalue references v2". When I wrote my blog post (after the VC10 CTP had been released, which was *very* early - this was before VC10 Beta 1), rrv2 hadn't been integrated into the C++0x Working Paper yet. However, it was on the horizon, and I mentioned it at the very end of the blog post. See "the future" section, where I linked to N2812, and explained that std::move() and std::forward()'s implementations would change. Fortunately, rrv2 was finalized in time for us to support it in VC10 Beta 2. Writing a blog post about rrv2 is on my list of things to do, but I haven't gotten a chance to do it yet. (Despite appearances, I don't quite get to write blog posts all day.) In std::move()'s implementation, a static_cast is necessary. Due to Dinkumware's conventions, we use C casts instead of C++ casts, but the effect is the same. (According to my understanding, they use C casts because some of the compilers that they support have trouble with C++ casts. VC doesn't have trouble with C++ casts, but we like to keep our implementation in sync with Dinkumware's master sources as much as possible. Amusingly, std::addressof() cannot be implemented properly with C casts, so we had to fix that bug by using C++ casts there, but that's the only special case that I'm aware of. If we followed my conventions, I'd use C++ casts everywhere, and I'd remove redundant parentheses in return statements. :->) Stephan T. Lavavej Visual C++ Libraries Developer -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Christopher Lux Sent: Wednesday, August 18, 2010 7:08 AM To: boost@lists.boost.org Subject: Re: [boost] boost internal compile problems after moving to 1.44 in VC10 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@gmail.com> wrote:
2010/8/17 Ion Gaztañaga <igaztanaga@gmail.com>:
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-fea...
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
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (3)
-
Christopher Lux
-
Ion Gaztañaga
-
Stephan T. Lavavej