Title
Base-class subobjects of standard-layout structs
Status
cd3
Section
11.4 [class.mem]
Submitter
Ville Voutilainen

Created on 2011-12-07.00:00:00 last changed 131 months ago

Messages

Date: 2013-04-15.00:00:00

[Moved to DR at the April, 2013 meeting.]

Date: 2012-02-15.00:00:00

Proposed resolution (February, 2012):

Change 11.4 [class.mem] paragraph 20 as follows:

A pointer to a standard-layout struct object, suitably converted using a reinterpret_cast, points to its initial member (or if that member is a bit-field, then to the unit in which it resides) and vice versa. If a standard-layout class object has any non-static data members, its address is the same as the address of its first non-static data member. Otherwise, its address is the same as the address of its first base class subobject (if any). [Note:...
Date: 2011-12-07.00:00:00

According to 11.4 [class.mem] paragraph 20,

A pointer to a standard-layout struct object, suitably converted using a reinterpret_cast, points to its initial member (or if that member is a bit-field, then to the unit in which it resides) and vice versa.

Given a standard-layout struct in which the non-static data members are in a base class (and hence the derived class is empty), it is not clear what the “initial member” is. Presumably the intent behind allowing such standard-layout classes was to treat the base class object and its first non-static data member as the initial member of the derived class, but this does not appear to be spelled out anywhere.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2013-10-14 00:00:00adminsetstatus: dr -> drwp
2013-05-03 00:00:00adminsetmessages: + msg4414
2013-05-03 00:00:00adminsetstatus: ready -> dr
2012-11-03 00:00:00adminsetstatus: review -> ready
2012-02-27 00:00:00adminsetmessages: + msg3759
2012-02-27 00:00:00adminsetstatus: open -> review
2011-12-07 00:00:00admincreate