Opened 8 years ago

Closed 8 years ago

#4426 closed Bugs (fixed)

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

Reported by: itsme@… Owned by: Ion Gaztañaga
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'

Attachments (0)

Change History (2)

comment:1 Changed 8 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 8 years ago by Ion Gaztañaga

Milestone: Boost 1.44.0Boost-1.45.0
Resolution: fixed
Status: newclosed

Fixed for Boost 1.45 in release branch

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment

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

Note: See TracTickets for help on using tickets.