Movatterモバイル変換


[0]ホーム

URL:


This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-12-20


1425. Base-class subobjects of standard-layout structs

Section:11.4  [class.mem]    Status:CD3    Submitter:Ville Voutilainen    Date:2011-12-07

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

According to 11.4 [class.mem] paragraph 20,

A pointer to a standard-layout struct object, suitably convertedusing areinterpret_cast, points to its initial member (or ifthat 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 membersare in a base class (and hence the derived class is empty), it is notclear what the “initial member” is. Presumably the intentbehind allowing such standard-layout classes was to treat the baseclass object and its first non-static data member as the initialmember of the derived class, but this does not appear to be spelled outanywhere.

Proposed resolution (February, 2012):

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

A pointer to a standard-layout struct object, suitably convertedusing areinterpret_cast, points to its initial member (or ifthat member is a bit-field, then to the unit in which it resides) andvice versa.If a standard-layout class object has anynon-static data members, its address is the same as the address of itsfirst non-static data member. Otherwise, its address is the same asthe address of its first base class subobject (if any).[Note:...



[8]ページ先頭

©2009-2026 Movatter.jp