This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/43915] Compiler flags error: error: invalid initialization of reference of type 'boost::thread&&' from expression of type 'boost::thread'
- From: "mlrus at mac dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 May 2010 13:25:26 -0000
- Subject: [Bug c++/43915] Compiler flags error: error: invalid initialization of reference of type 'boost::thread&&' from expression of type 'boost::thread'
- References: <bug-43915-19096@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #11 from mlrus at mac dot com 2010-05-14 13:25 -------
The following shows how to patch, compile and use boost 1.43.0 with g++
-std=c++0x. ?At issue are the rvalue references and typecasts in the boost
threading libraries. ?Simply tell Boost not to use its rvalue reference code
when it gets compiled, even with option std=c++0x is set. ?Here's how:
1. Modify operatingSystem.jam, to compile with the -std=c+0x option. ?Also,
remove the -no-cpp-precomp option
if it is not supported by your compiler. ?For OS X ?I
changed?tools/build/v2/tools/darwin.jam?at line 483 like this
# Misc options.
#flags darwin.compile OPTIONS : -no-cpp-precomp -gdwarf-2 ;
flags darwin.compile OPTIONS : -std=c++0x -gdwarf-2 ;
2. Modify gcc.hpp to disable the conditional compilation of rvalue references
(temporarily, until that part of the code works with g++)
diff gcc.hpp.orig gcc.hpp
124c124,125
# define BOOST_HAS_RVALUE_REFS
// # define BOOST_HAS_RVALUE_REFS
# define BOOST_NO_RVALUE_REFERENCES
In this manner you can compile and use Boost 1.43 fine gcc 4.5 or earlier, and
still build your software to use the c++0x features supported by the gnu
copmiler option -std=c++0x.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43915