Created on 2026-02-05.00:00:00 last changed 2 days ago
Proposed resolution:
This wording is relative to N5032.
Modify [meta.reflection.define.aggregate] as indicated:
consteval info data_member_spec(info type, data_member_options options);-4- Returns: […]
-5- Throws: `meta::exception` unless the following conditions are met:
(5.1) — `dealias(type)` represents either an object type or a reference type;
(5.2) — if `options.name` contains a value, then: […]
(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`,
(5.4.4) — V is not negative, and
(5.4.5) — if V equals `0`, then `options.name` does not contain a value; and
(5.4.?) — if `options.name` does not contain a value, then `is_const(type) || is_volatile(type)` is `false`; and
(5.5) — if `options.alignment` contains a value, it is an alignment value ([basic.align]) not less than `alignment_of(type)`.
DR 2229 changed [class.bit] p2 to say:
An unnamed bit-field shall not be declared with a cv-qualified type.
It follows that `define_aggregate` should have the same limitation, and thus in:
#include <meta>
constexpr auto d1 = std::meta::data_member_spec(^^const int, { .bit_width = 1 });
constexpr auto d2 = std::meta::data_member_spec(^^volatile int, { .bit_width = 1 });
constexpr auto d3 = std::meta::data_member_spec(^^const volatile int, { .bit_width = 1 });
all three `data_member_spec` should throw.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-02-09 14:31:33 | admin | set | messages: + msg15918 |
| 2026-02-05 00:00:00 | admin | create | |