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.

4316. {can_}substitute specification is ill-formed

Section: 21.4.13 [meta.reflection.substitute] Status: New Submitter: Matthias Wippich Opened: 2025-08-15 Last modified: 2025-08-17

Priority: Not Prioritized

View all issues with New status.

Discussion:

can_substitute and substitute are currently specified in terms of splices in a template argument list:

21.4.13 [meta.reflection.substitute] p3:

Returns: true if Z<[:Args:]...> is a valid template-id (13.3 [temp.names]) that does not name a function whose type contains an undeduced placeholder type. Otherwise, false.

21.4.13 [meta.reflection.substitute] p7:

Returns: ^^Z<[:Args:]...>.

This wording was introduced in P2996R11. However, merging in changes from P3687 "Final Adjustments to C++26 Reflection" in P2996R13 changed the rules for splices in this context. This makes can_substitute and substitute as specified currently ill-formed. We cannot use the given syntax to splice an arbitrary choice of values, types and templates anymore.

While the intent seems clear, this should be rephrased to be more technically correct.

Proposed resolution: