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


1813. Direct vs indirect bases in standard-layout classes

Section: Clause 11  [class]     Status: CD4     Submitter: Daveed Vandevoorde     Date: 2013-11-20

[Moved to DR at the November, 2014 meeting.]

One of the criteria for a standard-layout class in Clause 11 [class] paragraph 7 is:

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:

[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.)