I was under the impression that accessing a union
member other than the last one set is UB, but I can\'t seem to find a solid reference (other than answers clai
Something that is not yet mentioned by available answers is the footnote 37 in the paragraph 21 of the section 6.2.5:
Note that aggregate type does not include union type because an object with union type can only contain one member at a time.
This requirement seem to clearly imply that you must not write in a member and read in another one. In this case it might be undefined behavior by lack of specification.