Boost logo

Boost Users :

Subject: [Boost-users] [Interprocess] "You cannot bind an lvalue to an rvalue reference" in 1.44 using VC10
From: Phil Ratzloff (Phil.Ratzloff_at_[hidden])
Date: 2010-08-20 09:12:44


When I attempt to compile a project using boost::interprocess I get compile errors when I include managed_mapped_file.hpp when using VC10. I can create a simple project that is just the following code:

      #include <boost\interprocess\managed_mapped_file.hpp>
      int main(int argc, char* argv[])
      {
          return 0;
      }

When compiling, I get the following errors:

  Empty.cpp
c:\lib\boost_1_44_0\boost\interprocess\detail\move.hpp(342): error C2440: 'return' : cannot convert from 'boost::interprocess::mapped_region' to 'boost::interprocess::mapped_region &&'
          You cannot bind an lvalue to an rvalue reference
          c:\lib\boost_1_44_0\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
          with
          [
              T=boost::interprocess::mapped_region &
          ]
c:\lib\boost_1_44_0\boost\interprocess\detail\move.hpp(342): error C2440: 'return' : cannot convert from 'boost::interprocess::detail::file_wrapper' to 'boost::interprocess::detail::file_wrapper &&'
          You cannot bind an lvalue to an rvalue reference
          c:\lib\boost_1_44_0\boost\interprocess\detail\file_wrapper.hpp(63) : see reference to function template instantiation 'boost::interprocess::detail::file_wrapper &&boost::interprocess::move<boost::interprocess::detail::file_wrapper&>(T)' being compiled
          with
          [
              T=boost::interprocess::detail::file_wrapper &
          ]
c:\lib\boost_1_44_0\boost\interprocess\detail\move.hpp(342): error C2440: 'return' : cannot convert from 'boost::interprocess::file_mapping' to 'boost::interprocess::file_mapping &&'
          You cannot bind an lvalue to an rvalue reference
          c:\lib\boost_1_44_0\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
          with
          [
              T=boost::interprocess::file_mapping &
          ]

When I look at move.hpp(342) I find the following code:
      #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
        ...unused code...
      #else
      template <class T> inline
      typename remove_reference<T>::type&& move(T&& t)
      { return t; }
      #endif

It is complaining about the "return t;" statement. I have just moved up from boost 1.43, where I have been working without problems with VC10.

Is there something I should be doing to prevent this, or is it a bug?


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