[Bug c++/63732] constexpr is not constant expression, when cast member data pointer to data parent type
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Tue Nov 4 20:44:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63732
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler@googlemail.
| |com
--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
I disagree with your interpretation. Note that in your code example for yyy
there is an effective C-cast or reinterpret_cast. This is so, because your are
attempting to convert an address to a pointer of member of type
Number ComplexProperty::*
to
PropertyBase ComplexProperty::*
Irrespective of the private base classes, this kind of pointer conversion is
not allowed without a reinterpret_cast, but reinterpret_casts are not valid in
constants expressions.
The conversion to xxx is valid, because there is no type change involved
(Number ComplexProperty::* is converted to Number ComplexProperty::*) and for
the out-of-class member ComplexProperty::m_members definition the code is
well-formed, because you do have an effective reinterpret_cast but not in a
place where a constant expression would be required.
More information about the Gcc-bugs
mailing list