Skip to content

Commit d26b244

Browse files
committed
New issue from Dan Katz: "Precedes vs Reachable in [meta.reflection]"
1 parent 3cc8b0f commit d26b244

File tree

1 file changed

+177
-0
lines changed

1 file changed

+177
-0
lines changed

xml/issue4496.xml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4496" status="New">
5+
<title>Precedes vs Reachable in [meta.reflection]</title>
6+
<section><sref ref="[meta.reflection]"/></section>
7+
<submitter>Daniel Katz</submitter>
8+
<date>11 Dec 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
Discussion on the <a href="https://lists.isocpp.org/core/2025/12/19003.php">Core mailing list</a>
14+
surfaced a handful of places in <sref ref="[meta.reflection]"/> that use the "precedes" relation
15+
(defined in <sref ref="[basic.lookup]"/> and primarily used for name lookup) when the "reachable"
16+
relation (defined in <sref ref="[module.reach]"/>) is really what we want.
17+
</p>
18+
</discussion>
19+
20+
<resolution>
21+
<p>
22+
This wording is relative to <paper num="N5032"/>.
23+
</p>
24+
25+
<ol>
26+
<li><p>Modify <sref ref="[meta.reflection.names]"/> as indicated:</p>
27+
28+
<blockquote>
29+
<pre>
30+
consteval bool has_identifier(info r);
31+
</pre>
32+
<blockquote>
33+
<p>
34+
-1- <i>Returns</i>:
35+
</p>
36+
<ul style="list-style-type: none">
37+
<li><p>
38+
(1.1) &mdash; [&hellip;]
39+
</p></li>
40+
<li><p>
41+
[&hellip;]
42+
</p></li>
43+
<li><p>
44+
(1.8) &mdash; Otherwise, if `r` represents the parameter <tt><i>P</i></tt> of a function <tt><i>F</i></tt>,
45+
then let <tt><i>S</i></tt> be the set of declarations, ignoring any explicit instantiations, that
46+
<del>precede some</del><ins>are reachable from a</ins> point in the evaluation context and that declare
47+
either <tt><i>F</i></tt> or a templated function of which <tt><i>F</i></tt> is a specialization; [&hellip;]
48+
</p></li>
49+
<li><p>
50+
[&hellip;]
51+
</p></li>
52+
</ul>
53+
</blockquote>
54+
<pre>
55+
consteval string_view identifier_of(info r);
56+
consteval u8string_view u8identifier_of(info r);
57+
</pre>
58+
<blockquote>
59+
<p>
60+
-2- Let <tt><i>E</i></tt> be UTF-8 for `u8identifier_of`, and otherwise the ordinary literal encoding.
61+
<p/>
62+
-3- <i>Returns</i>: An <span style="font-variant: small-caps">ntmbs</span>, encoded with <tt><i>E</i></tt>, determined as follows:
63+
</p>
64+
<ul style="list-style-type: none">
65+
<li><p>
66+
(3.1) &mdash; [&hellip;]
67+
</p></li>
68+
<li><p>
69+
(3.2) &mdash; [&hellip;]
70+
</p></li>
71+
<li><p>
72+
(3.3) &mdash; Otherwise, if `r` represents the parameter <tt><i>P</i></tt> of a function <tt><i>F</i></tt>,
73+
then let <tt><i>S</i></tt> be the set of declarations, ignoring any explicit instantiations, that
74+
<del>precede some</del><ins>are reachable from a</ins> point in the evaluation context and that
75+
declare either <tt><i>F</i></tt> or a templated function of which <tt><i>F</i></tt> is a specialization;
76+
the name that was introduced by a declaration in <tt><i>S</i></tt> for the parameter corresponding to
77+
<tt><i>P</i></tt>.
78+
</p></li>
79+
<li><p>
80+
[&hellip;]
81+
</p></li>
82+
</ul>
83+
84+
</blockquote>
85+
</blockquote>
86+
</li>
87+
88+
<li><p>Modify <sref ref="[meta.reflection.queries]"/> as indicated:</p>
89+
90+
<blockquote>
91+
<pre>
92+
consteval info type_of(info r);
93+
</pre>
94+
<blockquote>
95+
<p>
96+
-2- <i>Returns</i>:
97+
</p>
98+
<ul style="list-style-type: none">
99+
<li><p>
100+
(2.1) &mdash; [&hellip;]
101+
</p></li>
102+
<li><p>
103+
[&hellip;]
104+
</p></li>
105+
<li><p>
106+
(2.4) &mdash; Otherwise, if `r` represents an enumerator <tt><i>N</i></tt> of an enumeration <tt><i>E</i></tt>, then:
107+
</p>
108+
<ul style="list-style-type: none">
109+
<li><p>
110+
(2.4.1) &mdash; If <tt><i>E</i></tt> is defined by a declaration <tt><i>D</i></tt> that
111+
<del>precedes</del><ins>is reachable from</ins> a point <tt><i>P</i></tt> in the evaluation context and
112+
<tt><i>P</i></tt> does not occur within an <i>enum-specifier</i> of <tt><i>D</i></tt>, then a reflection of
113+
<tt><i>E</i></tt>.
114+
</p></li>
115+
<li><p>
116+
(2.4.2) &mdash; Otherwise, a reflection of the type of <tt><i>N</i></tt> prior to the closing brace of the
117+
<i>enum-specifier</i> as specified in <sref ref="[dcl.enum]"/>.
118+
</p></li>
119+
</ul>
120+
</li>
121+
<li><p>
122+
[&hellip;]
123+
</p></li>
124+
</ul>
125+
</blockquote>
126+
[&hellip;]
127+
<pre>
128+
consteval bool has_default_argument(info r);
129+
</pre>
130+
<blockquote>
131+
<p>
132+
-41- <i>Returns</i>: If `r` represents a parameter <tt><i>P</i></tt> of a function <tt><i>F</i></tt>, then:
133+
</p>
134+
<ul style="list-style-type: none">
135+
<li><p>
136+
(41.1) &mdash; If <tt><i>F</i></tt> is a specialization of a templated function <tt><i>T</i></tt>,
137+
then `true` if there exists a declaration <tt><i>D</i></tt> of <tt><i>T</i></tt> that
138+
<del>precedes some</del><ins>is reachable from a</ins> point in the evaluation context and
139+
<tt><i>D</i></tt> specifies a default argument for the parameter of <tt><i>T</i></tt>
140+
corresponding to <tt><i>P</i></tt>. Otherwise, `false`.
141+
</p></li>
142+
<li><p>
143+
(41.2) &mdash; Otherwise, if there exists a declaration <tt><i>D</i></tt> of <tt><i>F</i></tt> that
144+
<del>precedes some</del><ins>is reachable from a</ins> point in the evaluation context and <tt><i>D</i></tt>
145+
specifies a default argument for <tt><i>P</i></tt>, then `true`.
146+
</p></li>
147+
</ul>
148+
</blockquote>
149+
</blockquote>
150+
</li>
151+
152+
<li><p>Modify <sref ref="[meta.reflection.annotation]"/> as indicated:</p>
153+
154+
<blockquote>
155+
<pre>
156+
consteval vector&lt;info&gt; annotations_of(info item);
157+
</pre>
158+
<blockquote>
159+
<p>
160+
-1- Let <tt><i>E</i></tt> be [&hellip;]
161+
<p/>
162+
-2- <i>Returns</i>: A `vector` containing all of the reflections <tt><i>R</i></tt> representing
163+
each annotation applying to each declaration of <tt><i>E</i></tt> that
164+
<del>precedes</del><ins>is reachable from</ins> either <del>some</del><ins>a</ins> point in the
165+
evaluation context (<sref ref="[expr.const]"/>) or a point immediately following the
166+
<i>class-specifier</i> of the outermost class for which such a point is in a complete-class context.
167+
[&hellip;]
168+
</p>
169+
</blockquote>
170+
</blockquote>
171+
</li>
172+
173+
</ol>
174+
175+
</resolution>
176+
177+
</issue>

0 commit comments

Comments
 (0)