[Bug c++/55993] [C++11] derived-to-base conversion fails in constant expression
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 15 19:24:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55993
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-15 19:24:03 UTC ---
Further reduced:
struct A { };
template<int N>
struct Head : A
{ };
struct Tuple : Head<0>, Head<1>
{ };
constexpr Tuple t{};
constexpr auto a = static_cast<const Head<1>&>(t);
tt.cc:11:49: error: accessing value of 't' through a 'const Head<1>' glvalue in
a constant expression
This only fails if the target of the cast is not the first base class (i.e.
accessing Head<1>) and if Head<N> derives from A, i.e. Tuple has two base
classes of type A
More information about the Gcc-bugs
mailing list