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

3930. Simplify type trait wording

Section: 21 [meta] Status: Tentatively NAD Submitter: Alisdair Meredith Opened: 2023-05-01 Last modified: 2023-06-01

Priority: Not Prioritized

View other active issues in [meta].

View all other issues in [meta].

View all issues with Tentatively NAD status.

Discussion:

There are many traits that have a requirement that they are instantiated only if "T shall be a complete type, cv void, or an array of unknown bound."

Breaking down what this means, by supporting cv-void and arrays of unknown bound (almost) the only remaining type-category is incomplete class types.

The remaining edge case is incomplete enumerations, but they are required to have a known fixed-base, so act as complete types, they can be copied, assigned, etc., without knowing the names of their enumerators.

Hence, I suggest clearer wording would be: "T shall not be an incomplete class type."

This is easier to understand, as we do not need to mentally enumerate every type against a list to check it qualifies; it is a simpler test for the library to check if we were to mandate these restrictions.

There are a very small number of traits with subtly different wording, where incomplete unions are supported, or arrays of unknown bound are not a concern due to invoking remove_all_extents first. The bulk of the changes can be made to traits with only the precise wording above though, and then we can review whether any of the remaining restrictions deserve a wording update of their own.

[2023-06-01; Reflector poll]

Set status to Tentatively NAD after four votes in favour during reflector poll, including a request to withdraw the issue from the submitter.

Incomplete enumeration types are found within the enum-specifier of an enum without a fixed underlying type:


enum E {
    A = sizeof(E) // error, E is incomplete at this point
};
and we definitely can't provide an underlying type for this case.

Proposed resolution:

This wording is relative to N4944.

  1. Throughout 21 [meta] replace all occurrences of

    T shall be a complete type, cv void, or an array of unknown bound.

    by

    T shall not be an incomplete class type.