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

2024-12-19


1090. Alignment of subobjects

Section: 6.7.3  [basic.align]     Status: C++11     Submitter: Daveed Vandevoorde     Date: 2010-06-23

[Voted into the WP at the March, 2011 meeting as part of paper N3262.]

The current wording of the Standard does not recognize the fact that the alignment of a complete object of a given type may be different from its alignment as a subobject. This arises in particular with virtual base classes. For example,

    struct B { long double d; };
    struct D: virtual B { char c; };

When D is a complete object, it will have a subobject of type B, which must be aligned appropriately for a long double. On the other hand, if D appears as a subobject of another object, the B subobject might be part of a different subobject, reducing the alignment requirement on the D subobject.

The Standard should make clear that it is the complete-object alignment that is being described, in parallel with the distinction between the size of a complete object and a subobject of the same type.