Title
`std::meta::reflect_constant_{string,array}` talks about template parameter objects of built-in array types
Status
nad
Section
[meta.define.static]
Submitter
Jiang An

Created on 2025-11-25.00:00:00 last changed 6 days ago

Messages

Date: 2025-12-05.16:51:20

Proposed resolution:

This wording is relative to N5014.

  1. Modify [meta.define.static] as indicated:

    template<ranges::input_range R>
      consteval info reflect_constant_string(R&& r);
    

    -2- Let `CharT` be ranges::range_value_t<R>.

    -3- Mandates: `CharT` is one of `char`, `wchar_t`, `char8_t`, `char16_t`, `char32_t`.

    -4- Let V be the pack of values of type `CharT` whose elements are the corresponding elements of `r`, except that if `r` refers to a string literal object, then V does not include the trailing null terminator of `r`.

    -5- Let P be the template parameter object ([temp.param])a constexpr object with static storage duration ([basic.stc.general]) of type const CharT[sizeof...(V) + 1] initialized with {V ..., CharT()}.

    […]

    template<ranges::input_range R>
      consteval info reflect_constant_array(R&& r);
    

    -8- Let `T` be ranges::range_value_t<R>.

    -9- Mandates: `T` is a structural type ([temp.param]), […].

    -10- Let V be the pack of values […].

    -11- Let P be

    • (11.1) — If sizeof...(V) > 0 is `true`, then the template parameter object ([temp.param])a constexpr object with static storage duration ([basic.stc.general]) of type const T[sizeof...(V)] initialized with {[:V:]...}.
    • (11.2) — Otherwise, the template parameter object of type array<T, 0> initialized with `{}`.

    […]

Date: 2025-12-05.00:00:00

[ 2025-12-05 Status changed: New → NAD. ]

Will be resolved by CWG 3111.

Date: 2025-11-15.00:00:00

[ 2025-11-27; Tomasz comments ]

The template argument object defintion was extended to cover objects of array types by CWG 3111. The usage of the term "template parameter object" is intentional here, as it guarantees that `reflect_constant_string` produces the same objects, where their content is the same.

Date: 2025-11-25.00:00:00

Currently, [meta.define.static] is talking about template parameter objects of built-in array types, but per [temp.param]/13, a template parameter object must be of a class type. So `std::meta::reflect_constant_{string,array}` are perhaps mis-specified.

History
Date User Action Args
2025-12-05 16:51:20adminsetmessages: + msg15779
2025-12-05 16:51:20adminsetstatus: new -> nad
2025-11-27 19:04:08adminsetmessages: + msg15770
2025-11-27 18:34:51adminsetmessages: + msg15769
2025-11-25 00:00:00admincreate