3823. Unnecessary precondition for is_aggregate

Section: [meta.unary.prop] Status: WP Submitter: Tomasz KamiƄski Opened: 2022-11-09 Last modified: 2022-11-15 16:24:02 UTC

Priority: Not Prioritized

View other active issues in [meta.unary.prop].

View all other issues in [meta.unary.prop].

View all issues with WP status.


This is resolution of GB-090 ( [meta.unary.prop] Unnecessary precondition for is_aggregate).

The precondition for is_aggregate is "remove_all_extents_t<T> shall be a complete type or cv void." This means that is_aggregate_v<Incomplete[2]> is undefined, but an array is always an aggregate, we don't need a complete element type to know that.

Historically the is_aggregate was introduced by LWG 2911 as part of the resolution of the NB comments. The comment proposed to introduce this trait with requirement "remove_all_extents_t<T> shall be a complete type, an array type, or (possibly cv-qualified) void.", that is close to resolution proposed in this issue. According to notes this was simplified during review, after realizing that remove_all_extents_t<T> is never an array type.

[Kona 2022-11-09; Move to Immediate]

[2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Immediate → WP.]

Proposed resolution:

This wording is relative to N4917.

  1. Modify 21.3.3 [meta.type.synop], Table 46 ([tab:meta.unary.prop]) — "Type property predicates" — as indicated:

    Table 48: Type property predicates [tab:meta.unary.prop]
    Template Condition Preconditions
    template<class T, class U>
    struct is_aggregate;
    T is an aggregate type (9.4.2 [dcl.init.aggr]) remove_all_extents_t<T> shall be an array type, a complete type, or cv void.