Created on 2013-11-20.00:00:00 last changed 95 months ago
[Moved to DR at the November, 2014 meeting.]
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.)
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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-02-06 00:00:00 | admin | set | status: drwp -> cd4 |
2015-05-25 00:00:00 | admin | set | status: dr -> drwp |
2015-04-13 00:00:00 | admin | set | messages: + msg5388 |
2014-11-24 00:00:00 | admin | set | status: tentatively ready -> dr |
2014-07-07 00:00:00 | admin | set | messages: + msg5078 |
2014-07-07 00:00:00 | admin | set | status: drafting -> tentatively ready |
2014-03-03 00:00:00 | admin | set | status: open -> drafting |
2013-11-20 00:00:00 | admin | create |