Author mark.dickinson
Recipients benjamin.peterson, mark.dickinson, vstinner
Date 2017-04-21.12:31:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In case anyone wants to have a go at interpreting the standard, the most immediately relevant part is the footnote to C99+TC3

If the member used to access the contents of a union object is not the same as the member last used to store a value in the object, the appropriate part of the object representation of the value is reinterpreted as an object representation in the new type as described in 6.2.6 (a process sometimes called "type punning"). This might be a trap representation.

Trap representations could potentially cause undefined behaviour, but are highly unlikely to occur in practice for us for this particular case, so I don't think they can possibly serve as the excuse for clang's behaviour.

The "reinterpreted as ..." language here strongly suggests that the union trick should be supported.

OTOH, this is just a footnote, so not normative ...
Date User Action Args
2017-04-21 12:31:32mark.dickinsonsetrecipients: + mark.dickinson, vstinner, benjamin.peterson
2017-04-21 12:31:32mark.dickinsonsetmessageid: <>
2017-04-21 12:31:32mark.dickinsonlinkissue30124 messages
2017-04-21 12:31:32mark.dickinsoncreate