Skip to content

Commit f18bba0

Browse files
committed
New issue from Lewis Baker: "Standard defined queries can't customize forwarding_query_t by inheriting from it"
1 parent 900b840 commit f18bba0

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

xml/issue4326.xml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4326" status="New">
5+
<title>Standard defined queries can't customize `forwarding_query_t` by inheriting from it</title>
6+
<section>
7+
<sref ref="[exec.fwd.env]"/>
8+
</section>
9+
<submitter>Lewis Baker</submitter>
10+
<date>25 Aug 2025</date>
11+
<priority>99</priority>
12+
13+
<discussion>
14+
<p>
15+
The definition of the `forwarding_query_t` (<sref ref="[exec.fwd.env]"/>) states that a query
16+
is a forwarding-query if either the expression `q.query(forwarding_query)` is a constant expression
17+
that evaluates to `true` or the query type inherits from `forwarding_query_t`.
18+
<p/>
19+
However, all of the queries defined in <sref ref="[exec]"/> are defined similar to the following:
20+
</p>
21+
<blockquote><pre>
22+
struct get_allocator_t { <i>unspecified</i> };
23+
</pre></blockquote>
24+
<p>
25+
While this definition allows for the members of the class to be unspecified, it still explicitly
26+
specifies that it has an empty list of base-classes and therefore cannot customize
27+
`forwarding_query_t` by inheriting from `forwarding_query_t`.
28+
<p/>
29+
We should consider whether we want to change the specification of queries that are to be
30+
forwarding-queries to allow inheritance from `forwarding_query_t` or otherwise remove the
31+
support for customizing `forwarding_query_t` by inheriting from it.
32+
<p/>
33+
<b>Proposed Approach:</b>
34+
<p/>
35+
Remove the rule that checks for inheritance from `forwarding_query_t`. Any query can already
36+
customize `forwarding_query_t` by defining a `query(forwarding_query_t)` member function, so
37+
there is no loss of functionality from doing this and it would simplify the design.
38+
</p>
39+
</discussion>
40+
41+
<resolution>
42+
<p>
43+
This wording is relative to <paper num="N5014"/>.
44+
</p>
45+
46+
<ol>
47+
48+
<li><p>Modify <sref ref="[exec.fwd.env]"/> as indicated:</p>
49+
50+
<blockquote>
51+
<p>
52+
-2- The name `forwarding_query` denotes a query object. For some query object `q` of type `Q`,
53+
`forwarding_query(q)` is expression-equivalent to:
54+
</p>
55+
<ol style="list-style-type: none">
56+
<li><p>(2.1) &mdash; <tt><i>MANDATE-NOTHROW</i>(q.query(forwarding_query))</tt> if that expression is well-formed.
57+
<p/>
58+
<i>Mandates</i>: The expression above has type `bool` and is a core constant expression if `q` is a core constant
59+
expression.
60+
</p></li>
61+
<li><p><del>(2.2) &mdash; Otherwise, `true` if <tt>derived_from&lt;Q, forwarding_query_t&gt;</tt> is `true`.</del></p></li>
62+
<li><p>(2.3) &mdash; Otherwise, `false`.</p></li>
63+
</ol>
64+
65+
</blockquote>
66+
67+
</li>
68+
69+
</ol>
70+
</resolution>
71+
72+
</issue>

0 commit comments

Comments
 (0)