https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114526

--- Comment #11 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
I think that simply failing to say whether a value of type X may be converted
to type Y is clearly enough for it at least to be unspecified whether or when
such conversions are possible in a cast at all (which is enough for rejecting
the translation unit). And since no requirements are imposed relating to such
conversions at either translation time or runtime, the definition of undefined
behavior is met.

If you try to cast from a struct to a union (for example), you violate a
constraint. If you try to do a conversion between a pointer and another scalar
type that's not one of the "may be converted" cases listed as allowing such a
conversion, you have undefined behavior through the lack of definition (if it's
an implicit conversion rather than a cast, doing it as an implicit conversion
violates a constraint unless it follows the requirements for assignment
expressions.)

Reply via email to