This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.

3034. P0767R1 breaks previously-standard-layout types

Section: 21.3.8.7 [meta.trans.other] Status: C++20 Submitter: Casey Carter Opened: 2017-11-12 Last modified: 2021-02-25

Priority: 0

View all other issues in [meta.trans.other].

View all issues with C++20 status.

Discussion:

P0767R1 "Expunge POD" changed the requirement for several library types from "POD" to "trivial." Since these types no longer provide/require the standard-layout portion of "POD," the change breaks:

It appears this breakage was not intentional and not discussed in LWG.

The fix is straight-forward: apply an additional standard-layout requirement to the affected types:

(Albeit the potential for breakage with max_align_t is admittedly small.)

[ 2017-11-14 Moved to Tentatively Ready after 8 positive votes for P0 on c++std-lib. ]

[2018-3-17 Adopted in Jacksonville]

Proposed resolution:

This wording is relative to N4700 + P0767R1.

  1. Change in 17.2.4 [support.types.layout] paragraph 5:

    The type max_align_t is a trivial standard-layout type whose alignment requirement is at least as great as that of every scalar type, and whose alignment requirement is supported in every context (6.7.6 [basic.align]).

  2. Change the table in 21.3.8.7 [meta.trans.other] as indicated:

    aligned_storage
    The member typedef type shall be a trivial standard-layout type suitable for use as uninitialized storage for any object whose size is at most Len and whose alignment is a divisor of Align.

    aligned_union
    The member typedef type shall be a trivial standard-layout type suitable for use as uninitialized storage for any object whose type is listed in Types; its size shall be at least Len.

  3. Change 27.1 [strings.general] paragraph 1 as indicated:

    This Clause describes components for manipulating sequences of any non-array trivial standard-layout (6.8 [basic.types]) type. Such types are called char-like types, and objects of char-like types are called char-like objects or simply characters.