
2013/5/15 Bryan Catanzaro
Hi Antony - Perhaps it is compiler dependent. Which version of MSVC did you reproduce the error with? Does that version have c++11 support enabled (in particular, rvalue references) As I said, with Boost 1.48.0, this code works with g++ 4.6 and 4.7. With 1.53.0, it works with g++ 4.6 and 4.7 only if c++11 support is turned off. If c++11 support is turned on, the code does not work. I've attached a shell script that compiles the attached code with the cross product of {(g++4.6, g++4.7), (boost1.48, boost1.53), (noc++11, yesc++11)}. As you can see from test.txt, the error happens only with boost 1.53 and c++11 support.
- bryan
Exactly the same things happen on GCC-4.5 and Clang-3.0.
But what is more interesting here:
convertible c;
const convertible& cc = c;
// Always compiles, using any flags, compiler and Boost version
my_variant y = cc;
my_variant y1 = static_cast