This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
[Moved to DR at the November, 2014 meeting.]
One of the criteria for a standard-layout class in Clause 11 [class] paragraph 7 is:
either has no non-static data members in the most derived class and at most one base class with non-static data members, or has no base classes with non-static data members,
In an example like
struct B { int i; }; struct C : B { }; struct D : C { };
this could be read as indicating that D is not a standard-layout class, since it has two base classes, one direct and one indirect, that each have a non-static data member. The intent should be clarified.
See also issue 1881 for a related question about standard-layout classes.
Proposed resolution (June, 2014):
Change Clause 11 [class] paragraph 7 as follows:
A standard-layout class is a class that:
has no non-static data members of type non-standard-layout class (or array of such types) or reference,
has no virtual functions (11.7.3 [class.virtual]) and no virtual base classes (11.7.2 [class.mi]),
has the same access control ( 11.8 [class.access]) for all non-static data members,
has no non-standard-layout base classes,
has at most one base class subobject of any given type,
either has no non-static data members in the most derived class and at most one base class with non-static data members, or has no base classes with non-static data membershas all non-static data members and bit-fields in the class and its base classes first declared in the same class, andhas no base classes of the same type as the first non-static data member.109
[Example:
struct B { int i; }; // standard-layout class struct C : B { }; // standard-layout class struct D : C { }; // standard-layout class struct E : D { char : 4; }; // not a standard-layout class struct Q {}; struct S : Q { }; struct T : Q { }; struct U : S, T { }; // not a standard-layout class—end example]
This resolution also resolves issue 1881.
(See also the related changes in the resolution of issue 1672.)