http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55993



--- Comment #7 from Marc Glisse <glisse at gcc dot gnu.org> 2013-01-15 19:34:17 
UTC ---

struct A {};

struct B:A {};

struct C:A {};

struct D:B,C {};



constexpr D d;

constexpr const C& e=d; // OK

constexpr auto f=static_cast<const C&>(d); // FAIL

constexpr auto g=static_cast<const B&>(d); // FAIL different



Interesting mix of error messages:



e.cc:8:41: error: accessing value of 'd' through a 'const C' glvalue in a

constant expression

 constexpr auto f=static_cast<const C&>(d); // FAIL

                                         ^

e.cc:9:41: error: the value of 'd' is not usable in a constant expression

 constexpr auto g=static_cast<const B&>(d); // FAIL different

                                         ^

e.cc:6:13: note: 'd' used in its own initializer

 constexpr D d;

             ^

Reply via email to