http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57599
Daniel Krügler <daniel.kruegler at googlemail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |daniel.kruegler@googlemail. | |com --- Comment #4 from Daniel Krügler <daniel.kruegler at googlemail dot com> --- I created a test case for all type conversion operators: struct A {}; struct B : public A {}; template<class, class> struct is_same { static constexpr bool value = false; }; template<class T> struct is_same<T, T> { static constexpr bool value = true; }; template<class T> T val(); static_assert(is_same<decltype(static_cast<const A*>(val<B*>())), const A*>::value, "Ouch"); static_assert(is_same<decltype(static_cast<const A&>(val<B&>())), const A&>::value, "Ouch"); static_assert(is_same<decltype(const_cast<const A*>(val<A*>())), const A*>::value, "Ouch"); static_assert(is_same<decltype(const_cast<const A&>(val<A&>())), const A&>::value, "Ouch"); static_assert(is_same<decltype(reinterpret_cast<const A*>(val<B*>())), const A*>::value, "Ouch"); static_assert(is_same<decltype(reinterpret_cast<const A&>(val<B&>())), const A&>::value, "Ouch"); static_assert(is_same<decltype(dynamic_cast<const A*>(val<B*>())), const A*>::value, "Ouch"); // Error! static_assert(is_same<decltype(dynamic_cast<const A&>(val<B&>())), const A&>::value, "Ouch"); // Error! In agreement with that bug report I see failures for the last two even for gcc 4.9.0 20130609 (experimental)