Ticket #4426 (closed Bugs: fixed)

Opened 7 years ago

Last modified 7 years ago

invalid init of reference with gcc 4.5, 4.6 with -std=c++0x

Reported by: itsme@… Owned by: igaztanaga
Milestone: Boost 1.45.0 Component: interprocess
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:


see #4396 - for the threads library this problem is now solved.

this code builds fine with msvc2010

with gcc 4.6 beta i get the same error.

without the -std=c++0x option it compiles ok

with boost_1_40_0 and boost_1_39_0 i also get the same error.

echo '#include "boost/interprocess/file_mapping.hpp"' > xinc.cpp
g++-mp-4.5 -I /opt/local/include/ xinc.cpp -std=c++0x

In file included from /opt/local/include/boost/interprocess/detail/utilities.hpp:25:0,
                 from /opt/local/include/boost/interprocess/file_mapping.hpp:19,
                 from xinc.cpp:1:
/opt/local/include/boost/interprocess/detail/move.hpp: In function 'typename boost::remove_reference<T>::type&& boost::interprocess::move(T&&) [with T = boost::interprocess::file_mapping&, typename boost::remove_reference<T>::type = boost::interprocess::file_mapping]':
/opt/local/include/boost/interprocess/file_mapping.hpp:62:55:   instantiated from here
/opt/local/include/boost/interprocess/detail/move.hpp:342:11: error: invalid initialization of reference of type 'boost::remove_reference<boost::interprocess::file_mapping&>::type&&' from expression of type 'boost::interprocess::file_mapping'


Change History

comment:1 Changed 7 years ago by itsme@…

see [62717]

this is the patch to make ipc build with gcc4.5

Index: boost/interprocess/detail/move.hpp
--- boost/interprocess/detail/move.hpp	(revision 64212)
+++ boost/interprocess/detail/move.hpp	(working copy)
@@ -355,7 +355,7 @@
 template <class T> inline 
 typename remove_reference<T>::type&& move(T&& t)
-{  return t;   }
+{  return static_cast<typename remove_reference<T>::type&&>(t);   }

comment:2 Changed 7 years ago by igaztanaga

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from Boost 1.44.0 to Boost-1.45.0

Fixed for Boost 1.45 in release branch


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.