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 [meta.reflection] Status: New Submitter: Daniel Katz Opened: 2025-12-11 Last modified: 2025-12-20
Priority: Not Prioritized
View all issues with New status.
Discussion:
Discussion on the Core mailing list surfaced a handful of places in 21.4 [meta.reflection] that use the "precedes" relation (defined in 6.5 [basic.lookup] and primarily used for name lookup) when the "reachable" relation (defined in 10.7 [module.reach]) is really what we want.
Proposed resolution:
This wording is relative to N5032.
Modify 21.4.6 [meta.reflection.names] as indicated:
consteval bool has_identifier(info r);-1- Returns:
(1.1) — […]
[…]
(1.8) — Otherwise, if
rrepresents the parameterPof a functionF, then letSbe the set of declarations, ignoring any explicit instantiations, thatprecede someare reachable from a point in the evaluation context and that declare eitherFor a templated function of whichFis a specialization; […][…]
consteval string_view identifier_of(info r); consteval u8string_view u8identifier_of(info r);-2- Let
-3- Returns: An ntmbs, encoded withEbe UTF-8 foru8identifier_of, and otherwise the ordinary literal encoding.E, determined as follows:
(3.1) — […]
(3.2) — […]
(3.3) — Otherwise, if
rrepresents the parameterPof a functionF, then letSbe the set of declarations, ignoring any explicit instantiations, thatprecede someare reachable from a point in the evaluation context and that declare eitherFor a templated function of whichFis a specialization; the name that was introduced by a declaration inSfor the parameter corresponding toP.[…]
Modify 21.4.7 [meta.reflection.queries] as indicated:
consteval info type_of(info r);[…]-2- Returns:
(2.1) — […]
[…]
(2.4) — Otherwise, if
rrepresents an enumeratorNof an enumerationE, then:
(2.4.1) — If
Eis defined by a declarationDthatprecedesis reachable from a pointPin the evaluation context andPdoes not occur within an enum-specifier ofD, then a reflection ofE.(2.4.2) — Otherwise, a reflection of the type of
Nprior to the closing brace of the enum-specifier as specified in 9.8.1 [dcl.enum].[…]
consteval bool has_default_argument(info r);-41- Returns: If
rrepresents a parameterPof a functionF, then:
(41.1) — If
Fis a specialization of a templated functionT, thentrueif there exists a declarationDofTthatprecedes someis reachable from a point in the evaluation context andDspecifies a default argument for the parameter ofTcorresponding toP. Otherwise,false.(41.2) — Otherwise, if there exists a declaration
DofFthatprecedes someis reachable from a point in the evaluation context andDspecifies a default argument forP, thentrue.
Modify 21.4.18 [meta.reflection.annotation] as indicated:
consteval vector<info> annotations_of(info item);-1- Let
-2- Returns: AEbe […]vectorcontaining all of the reflectionsRrepresenting each annotation applying to each declaration ofEthatprecedesis reachable from eithersomea point in the evaluation context (7.7 [expr.const]) or a point immediately following the class-specifier of the outermost class for which such a point is in a complete-class context. […]