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

4423. meta::data_member_spec allows negative bit-field widths

Section: 21.4.16 [meta.reflection.define.aggregate] Status: New Submitter: Jakub Jelinek Opened: 2025-10-20 Last modified: 2025-10-20

Priority: Not Prioritized

View other active issues in [meta.reflection.define.aggregate].

View all other issues in [meta.reflection.define.aggregate].

View all issues with New status.

Discussion:

The meta::data_member_spec function doesn't restrict options.bit_width to be non-negative.

Proposed resolution:

This wording is relative to N5014.

  1. Modify 21.4.16 [meta.reflection.define.aggregate] as indicated:

    • (5.3) — if options.name does not contain a value, then options.bit_width contains a value;
    • (5.4) — if options.bit_width contains a value V, then
      • (5.4.1) — is_integral_type(type) || is_enum_type(type) is true,
      • (5.4.2) — options.alignment does not contain a value,
      • (5.4.3) — options.no_unique_address is false, and
      • (5.4.?) — V is not negative, and
      • (5.4.4) — if V equals 0, then options.name does not contain a value; and
    • (5.5) — if options.alignment contains a value, it is an alignment value (6.8.3 [basic.align]) not less than alignment_of(type).