
Stefan Slapeta <stefan_nospam_@slapeta.com> writes:
Has anybody a solution for this? Seems that all CWs have problems with casts in combination with conversion functions.
template<class T> void test ( T const& y, T const& z ) { boost::value_initialized<T> x ; BOOST_TEST ( y == x ) ; BOOST_TEST ( y == get(x) ) ; static_cast<T&>(x) = z ; get(x) = z ; BOOST_TEST ( x == z ) ; boost::value_initialized<T> const x_c ; BOOST_TEST ( y == x_c ) ; BOOST_TEST ( y == get(x_c) ) ; static_cast<T&>(x_c) = z ; ### mwcc Compiler: # File: ..\libs\utility\value_init_test.cpp # -------------------------------------------- # 76: static_cast<T&>(x_c) = z ; # Error: ^ # constness casted away The only solution I can think of is to change the test: T& t_ref = x_c; t_ref = z; or implicit_cast<T&>(x_c) = z; -- Dave Abrahams Boost Consulting http://www.boost-consulting.com