A trivial class is a class that is trivially copyable and
has one or more eligible default constructors ([class.default.ctor]),
all of which are trivial.
If X is a non-union class type with a non-static data
member of type X0
that is either of zero size or
is the first non-static data member of X
(where said member may be an anonymous union),
the set M(X) consists of X0 and the elements of
M(X0).
If X is a union type, the set M(X) is
the union of all M(Ui) and the set containing all Ui,
where each Ui is the type of the ith non-static data member
of X.
[Example 1: struct B {int i; }; // standard-layout classstruct C : B {}; // standard-layout classstruct D : C {}; // standard-layout classstruct E : D {char:4; }; // not a standard-layout classstruct Q {};
struct S : Q {};
struct T : Q {};
struct U : S, T {}; // not a standard-layout class — end example]
[Example 2: struct N {// neither trivial nor standard-layoutint i;
int j;
virtual~N();
};
struct T {// trivial but not standard-layoutint i;
private:int j;
};
struct SL {// standard-layout but not trivialint i;
int j;
~SL();
};
struct POD {// both trivial and standard-layoutint i;
int j;
};
— end example]
This ensures that two subobjects that have the same class type and that
belong to the same most derived object are not allocated at the same
address ([expr.eq]).