Title
Disallow has_unique_object_representations<Incomplete[]>
Status
voting
Section
[meta.unary.prop]
Submitter
Jonathan Wakely

Created on 2024-06-25.00:00:00 last changed yesterday

Messages

Date: 2024-08-02.21:32:21

Proposed resolution:

This wording is relative to N4981.

  1. Modify [meta.unary.prop] as indicated:

    TemplateConditionPreconditions
    template<class T>
    struct has_unique_object_representations;
    For an array type `T`, the same result as has_unique_object_representations_v<remove_all_extents_t<T>>, otherwise see below. remove_all_extents_t<T> T shall be a complete type, or cv `void`, or an array of unknown bound.

    [Drafting note: We could use remove_extent_t<T> to remove just the first array dimension, because only that first one can have an unknown bound. The proposed resolution uses remove_all_extents_t<T> for consistency with the Condition column.]

Date: 2024-08-15.00:00:00

[ 2024-08-02; Reflector poll ]

Set status to Tentatively Ready after nine votes in favour during reflector poll.

Date: 2024-06-25.00:00:00

The type completeness requirements for `has_unique_object_representations` say:

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

This implies that the trait works for all arrays of unknown bound, whether the element type is complete or not. That seems to be incorrect, because has_unique_object_representations_v<Incomplete[]> is required to have the same result as has_unique_object_representations_v<Incomplete> which is ill-formed if `Incomplete` is an incomplete class type.

I think we need the element type to be complete to be able to give an answer. Alternatively, if the intended result for an array of unknown bound is false (maybe because there can be no objects of type `T[]`, or because we can't know that two objects declared as `extern T a[];` and `extern T b[];` have the same number of elements?) then the condition for the trait needs to be special-cased as `false` for arrays of unknown bound. The current spec is inconsistent, we can't allow arrays of unknown bound and apply the current rules to determine the trait's result.

History
Date User Action Args
2024-11-19 16:09:07adminsetstatus: ready -> voting
2024-08-02 21:32:21adminsetmessages: + msg14286
2024-08-02 21:32:21adminsetstatus: new -> ready
2024-06-25 17:20:07adminsetmessages: + msg14216
2024-06-25 00:00:00admincreate