§9.0
7. A class S is a standard-layout class if it:
(7.3) has the same access control (Clause 11 ) for all non-static data members,
8 A standard-layout struct is a standard-layout class defined with the class-key struct or the class-key class . A standard-layout union is a standard-layout class defined with the class-key union .
AFAICT, §9.0.7.3 exists because of §9.2.13
13 Nonstatic data members of a (non-union) class with the same access control (Clause 11 ) are allocated so that later members have higher addresses within a class object. The order of allocation of non-static data members with different access control is unspecified (Clause 11 ). Implementation alignment requirements might cause two adjacent members not to be allocated immediately after each other; so might requirements for space for managing virtual functions ( 10.3 ) and virtual base classes ( 10.1 ).
However, this does not seem to apply to unions, as all (non-static data) members of a union have the same address. Is this a defect in the standard? Or is there some compelling reason why that I'm not seeing?
It looks to me like the benefit of allowing multiple access specifiers in the
union
case were not outweighed by the cost of the inconsistency and additional words introduced.