Created on 2026-06-04.00:00:00 last changed 1 week ago
Proposed resolution:
This wording is relative to N5046.
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.?) — `remove_all_extents(dealias(type))` does not represent an anonymous union type,
(5.2) — […]
[…]
CWG 3130 added to [class.union.anon]:
"Each object of such an unnamed type shall be such an unnamed object."
restriction. I think we should therefore throw from `data_member_spec` if one attempts to use it with an anonymous union type.
#include <meta>
struct S { union { int a; long b; };
constexpr auto ctx = std::meta::access_context::unchecked ();
using U = [: members_of (^^S, ctx)[0] :];
constexpr auto m = data_member_spec (^^U, { .name = "_" });
So, add after [meta.reflection.define.aggregate] bullet (5.2):
— `dealias(type)` does not represent an anonymous union type,
Though, maybe better:
— `remove_all_extents(dealias(type))` does not represent an anonymous union type,
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-06-13 13:22:06 | admin | set | messages: + msg16435 |
| 2026-06-04 00:00:00 | admin | create | |