Skip to content

Commit 2e4a040

Browse files
committed
New issue from Jakub Jelinek and Jonathan: Clarify what meta::reflect_string_constant considers a string literal
1 parent 11dc505 commit 2e4a040

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

xml/issue4426.xml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4426" status="New">
5+
<title>Clarify what `meta::reflect_constant_string` considers a string literal</title>
6+
<section><sref ref="[meta.reflection.array]"/></section>
7+
<submitter>Jakub Jelinek</submitter>
8+
<date>21 Oct 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
`meta::reflect_constant_string` says:
14+
<blockquote>
15+
Let <i>V</i> be the pack of values of type `CharT` whose elements are
16+
the corresponding elements of `r`,
17+
except that if `r` refers to a string literal object,
18+
then <i>V</i> does not include the trailing null terminator of `r`.
19+
</blockquote>
20+
It's unclear how the implementation should decide whether `r` refers to
21+
a string literal. If `R` models `contiguous_iterator`, should it use
22+
`meta::is_string_literal(ranges::data(r))`?
23+
Should it omit the `'\0'` from `string_view("abc", 3)`?
24+
</p>
25+
<p>
26+
Also, "null terminator" is only defined in <sref ref="[basic.string.general]"/>
27+
and not used for string literal objects (<sref ref="[lex.string]"/>).
28+
</p>
29+
</discussion>
30+
31+
<resolution>
32+
<p>
33+
This wording is relative to <paper num="N5014"/>.
34+
</p>
35+
36+
<ol>
37+
38+
<li><p>Modify <sref ref="[meta.reflection.array]"/> as indicated:</p>
39+
40+
<blockquote>
41+
<pre>
42+
template&lt;ranges::input_range R&gt;
43+
consteval info reflect_constant_string(R&amp;&amp; r);
44+
</pre>
45+
<blockquote>
46+
<p>-2-
47+
Let `CharT` be <code>ranges::range_value_t&lt;R&gt;</code>.
48+
</p>
49+
<p>-3- <i>Mandates</i>:
50+
`CharT` is one of `char`, `wchar_t`, `char8_t`, `char16_t`, `char32_t`.
51+
</p>
52+
<p>
53+
Let <i>V</i> be the pack of values of type `CharT` whose elements are
54+
the corresponding elements of `r`,
55+
except that if `r` <del>refers</del> <ins>is a reference</ins>
56+
to a string literal object,
57+
then <i>V</i> does not include the <del>trailing null terminator</del>
58+
<ins>terminating <span style="font-variant: small-caps">u+0000 null</span>
59+
character</ins>
60+
of `r`.
61+
</p>
62+
</blockquote>
63+
</blockquote>
64+
</li>
65+
</ol>
66+
67+
</resolution>
68+
69+
</issue>

0 commit comments

Comments
 (0)