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.
Section: 21.4.9 [meta.reflection.access.queries], 21.4.18 [meta.reflection.annotation], 21.4.15 [meta.reflection.array] Status: New Submitter: Jonathan Wakely Opened: 2025-10-24 Last modified: 2025-10-24
Priority: Not Prioritized
View all issues with New status.
Discussion:
Addresses US 102-209"is a constant (sub)expression" is incorrect now that errors are reported via exceptions.
Proposed resolution:
This wording is relative to N5014.
Modify 21.4.9 [meta.reflection.access.queries] as indicated:
consteval bool has_inaccessible_nonstatic_data_members(info r, access_context ctx);-5- Returns:
trueifis_accessible(R, ctx)isfalsefor any R innonstatic_data_members_of(r, access_context::unchecked()). Otherwise,false.-6- Throws:
meta::exceptionunless
- (6.1) — The evaluation of
nonstatic_data_members_of(r, access_context::unchecked())is a constant subexpressionwould not exit via an exception and- (6.2) —
rdoes not represent a closure type.consteval bool has_inaccessible_bases(info r, access_context ctx);-5- Returns:
trueifis_accessible(R, ctx)isfalsefor any R inbases_of(r, access_context::unchecked()). Otherwise,false.-6- Throws:
meta::exceptionunless The evaluation ofbases_of(r, access_context::unchecked())is a constant subexpressionwould not exit via an exception.
Modify 21.4.18 [meta.reflection.annotation] as indicated:
consteval vector<info> annotations_of_with_type(info item, info type);-4- Returns: A
vectorcontaining each elementeofannotations_of(item)whereremove_const(type_of(e)) == remove_const(type)istrue, preserving their order.-5- Throws:
meta::exceptionunless
- (5.1) — The evaluation of
annotations_of(item)is a constant subexpressionwould not exit via an exception and- (5.2) —
dealias(type)represents a type that is complete from some point in the evaluation context.
Modify 21.4.18 [meta.reflection.annotation] as indicated:
template<ranges::input_range R> consteval info reflect_constant_array(R&& r);-8- Let
Tberanges::range_value_t<R>.-9- Mandates:
Tis a structural type (13.2 [temp.param]),is_constructible_v<T, ranges::range_reference_t<R>>istrue, andis_copy_constructible_v<T>istrue.-10- Let V be the pack of values of type
infoof the same size asr, where the ith element isreflect_constant(ei), whereeiis the ith element ofr.-11- Let P be
- (11.1) — If
sizeof...(V) > 0istrue, then the template parameter object (13.2 [temp.param]) of typeconst T[sizeof...(V)]initialized with{[:V:]...}.- (11.2) — Otherwise, the template parameter object of type
array<T, 0>initialized with{}.-12- Returns:
^^P.-13- Throws:
meta::exceptionunless The evaluation ofreflect_constant(e)is a constant subexpressionwould not exit via an exception for every elementeofr.