CWG Issue 2120 (original) (raw)
This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-04-13
2120. Array as first non-static data member in standard-layout class
Section: Clause 11 [class]Status: CD4Submitter: Hubert TongDate: 2015-05-06
[Moved to DR at the October, 2015 meeting.]
The specification for determining whether a derived class is a standard-layout class, considering the types of its bases and those associated with its initial member, overlooked the case of a class whose first member is an array.
Proposed resolution (May, 2015):
Change Clause 11 [class] paragraph 7 as follows:
...M(X) is defined as follows:
- If X is a non-union class type, the set M(X) is empty ifX has no (possibly inherited ( 11.7 [class.derived])) non-static data members; otherwise, it consists of the type of the first non-static data member of X (where said member may be an anonymous union), X0, and the elements of_M_(X0).
- If X is a union type, the set M(X) is the union of all M(U_i_) and the set containing all U_i_, where eachU_i_ is the type of the _i_th non-static data member of X.
- If X is an array type with element typeXe, the set M(X) consists ofXe and the elements of_M_(Xe).
- If X is a non-class, non-array type, the set M(X) is empty.
[Note: M(X) is the set of the types of all non-base-class subobjects that are guaranteed in a standard-layout class to be at a zero offset inX. —_end note_]