This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 113d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-04-05


2287. Pointer-interconvertibility in non-standard-layout unions

Section: 6.8.4  [basic.compound]     Status: CD5     Submitter: Richard Smith     Date: 2016-07-06

[Voted into the WP at the July, 2017 meeting.]

According to 11.5 [class.union] paragraph 2,

[Note: A union object and its non-static data members are pointer-interconvertible (6.8.4 [basic.compound], 7.6.1.9 [expr.static.cast]). As a consequence, all non-static data members of a union object have the same address. —end note]

However, the normative wording now only requires this for standard-layout unions.

Proposed resolution (April, 2017):

Change 6.8.4 [basic.compound] bullet 4.2 as follows:

Two objects a and b are pointer-interconvertible if: