Skip to content

Commit 2a8c237

Browse files
committed
New issue from Jiang An: "std::meta::reflect_constant_{string,array} talks about template parameter objects of built-in array types"
1 parent dac3b6c commit 2a8c237

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

xml/issue4484.xml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4484" status="New">
5+
<title>`std::meta::reflect_constant_{string,array}` talks about template parameter objects of built-in array types</title>
6+
<section>
7+
<sref ref="[meta.define.static]"/>
8+
</section>
9+
<submitter>Jiang An</submitter>
10+
<date>25 Nov 2025</date>
11+
<priority>99</priority>
12+
13+
<discussion>
14+
<p>
15+
Currently, <sref ref="[meta.define.static]"/> is talking about template parameter objects of built-in array types,
16+
but per <sref ref="[temp.param]"/>/13, a template parameter object must be of a class type. So
17+
`std::meta::reflect_constant_{string,array}` are perhaps mis-specified.
18+
</p>
19+
</discussion>
20+
21+
<resolution>
22+
<p>
23+
This wording is relative to <paper num="N5014"/>.
24+
</p>
25+
26+
<ol>
27+
28+
<li><p>Modify <sref ref="[meta.define.static]"/> as indicated:</p>
29+
30+
<blockquote>
31+
<pre>
32+
template&lt;ranges::input_range R&gt;
33+
consteval info reflect_constant_string(R&amp;&amp; r);
34+
</pre>
35+
<blockquote>
36+
<p>
37+
-2- Let `CharT` be <tt>ranges::range_value_t&lt;R&gt;</tt>.
38+
<p/>
39+
-3- <i>Mandates</i>: `CharT` is one of `char`, `wchar_t`, `char8_t`, `char16_t`, `char32_t`.
40+
<p/>
41+
-4- Let <tt><i>V</i></tt> be the pack of values of type `CharT` whose elements
42+
are the corresponding elements of `r`, except that if `r` refers to a string literal object,
43+
then <tt><i>V</i></tt> does not include the trailing null terminator of `r`.
44+
<p/>
45+
-5- Let <tt><i>P</i></tt> be <del>the template parameter object
46+
(<sref ref="[temp.param]"/>)</del><ins>a constexpr object with static storage duration
47+
(<sref ref="[basic.stc.general]"/>)</ins> of type <tt>const CharT[sizeof...(<i>V</i>) + 1]</tt>
48+
initialized with <tt>{<i>V</i> ..., CharT()}</tt>.
49+
<p/>
50+
[&hellip;]
51+
</p>
52+
</blockquote>
53+
<pre>
54+
template&lt;ranges::input_range R&gt;
55+
consteval info reflect_constant_array(R&amp;&amp; r);
56+
</pre>
57+
<blockquote>
58+
<p>
59+
-8- Let `T` be <tt>ranges::range_value_t&lt;R&gt;</tt>.
60+
<p/>
61+
-9- <i>Mandates</i>: `T` is a structural type (<sref ref="[temp.param]"/>), [&hellip;].
62+
<p/>
63+
-10- Let <tt><i>V</i></tt> be the pack of values [&hellip;].
64+
<p/>
65+
-11- Let <tt><i>P</i></tt> be
66+
</p>
67+
<ul style="list-style-type: none">
68+
<li>(11.1) &mdash;
69+
If <tt>sizeof...(<i>V</i>) &gt; 0</tt> is `true`, then <del>the template parameter object
70+
(<sref ref="[temp.param]"/>)</del><ins>a constexpr object with static storage duration
71+
(<sref ref="[basic.stc.general]"/>)</ins> of type <tt>const T[sizeof...(<i>V</i>)]</tt>
72+
initialized with <tt>{[:<i>V</i>:]...}</tt>.
73+
</li>
74+
<li>(11.2) &mdash;
75+
Otherwise, the template parameter object of type <tt>array&lt;T, 0&gt;</tt> initialized with `{}`.
76+
</li>
77+
</ul>
78+
<p>
79+
[&hellip;]
80+
</p>
81+
</blockquote>
82+
</blockquote>
83+
84+
</li>
85+
</ol>
86+
87+
</resolution>
88+
89+
90+
91+
</issue>

0 commit comments

Comments
 (0)