forked from cplusplus/LWG
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathissue4484.xml
More file actions
98 lines (86 loc) · 2.98 KB
/
issue4484.xml
File metadata and controls
98 lines (86 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?xml version='1.0' encoding='utf-8' standalone='no'?>
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
<issue num="4484" status="New">
<title>`std::meta::reflect_constant_{string,array}` talks about template parameter objects of built-in array types</title>
<section>
<sref ref="[meta.define.static]"/>
</section>
<submitter>Jiang An</submitter>
<date>25 Nov 2025</date>
<priority>99</priority>
<discussion>
<p>
Currently, <sref ref="[meta.define.static]"/> is talking about template parameter objects of built-in array types,
but per <sref ref="[temp.param]"/>/13, a template parameter object must be of a class type. So
`std::meta::reflect_constant_{string,array}` are perhaps mis-specified.
</p>
<note>2025-11-27; Tomasz comments</note>
<p>
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.
</p>
</discussion>
<resolution>
<p>
This wording is relative to <paper num="N5014"/>.
</p>
<ol>
<li><p>Modify <sref ref="[meta.define.static]"/> as indicated:</p>
<blockquote>
<pre>
template<ranges::input_range R>
consteval info reflect_constant_string(R&& r);
</pre>
<blockquote>
<p>
-2- Let `CharT` be <tt>ranges::range_value_t<R></tt>.
<p/>
-3- <i>Mandates</i>: `CharT` is one of `char`, `wchar_t`, `char8_t`, `char16_t`, `char32_t`.
<p/>
-4- Let <tt><i>V</i></tt> 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 <tt><i>V</i></tt> does not include the trailing null terminator of `r`.
<p/>
-5- Let <tt><i>P</i></tt> be <del>the template parameter object
(<sref ref="[temp.param]"/>)</del><ins>a constexpr object with static storage duration
(<sref ref="[basic.stc.general]"/>)</ins> of type <tt>const CharT[sizeof...(<i>V</i>) + 1]</tt>
initialized with <tt>{<i>V</i> ..., CharT()}</tt>.
<p/>
[…]
</p>
</blockquote>
<pre>
template<ranges::input_range R>
consteval info reflect_constant_array(R&& r);
</pre>
<blockquote>
<p>
-8- Let `T` be <tt>ranges::range_value_t<R></tt>.
<p/>
-9- <i>Mandates</i>: `T` is a structural type (<sref ref="[temp.param]"/>), […].
<p/>
-10- Let <tt><i>V</i></tt> be the pack of values […].
<p/>
-11- Let <tt><i>P</i></tt> be
</p>
<ul style="list-style-type: none">
<li>(11.1) —
If <tt>sizeof...(<i>V</i>) > 0</tt> is `true`, then <del>the template parameter object
(<sref ref="[temp.param]"/>)</del><ins>a constexpr object with static storage duration
(<sref ref="[basic.stc.general]"/>)</ins> of type <tt>const T[sizeof...(<i>V</i>)]</tt>
initialized with <tt>{[:<i>V</i>:]...}</tt>.
</li>
<li>(11.2) —
Otherwise, the template parameter object of type <tt>array<T, 0></tt> initialized with `{}`.
</li>
</ul>
<p>
[…]
</p>
</blockquote>
</blockquote>
</li>
</ol>
</resolution>
</issue>