Skip to content

Commit cad0090

Browse files
committed
New issue from Eric Niebler: "COMMON-DOMAIN should test for convertibility to default_domain"
1 parent 6be2734 commit cad0090

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

xml/issue4570.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="4570" status="New">
5+
<title><tt><i>COMMON-DOMAIN</i></tt> should test for convertibility to `default_domain`</title>
6+
<section>
7+
<sref ref="[exec.snd.expos]"/>
8+
</section>
9+
<submitter>Eric Niebler</submitter>
10+
<date>13 Apr 2026</date>
11+
<priority>99</priority>
12+
13+
<discussion>
14+
<p>
15+
<paper num="P3826R5"/> accepted at the Croydon meeting adds the following paragraph to
16+
<sref ref="[exec.snd.expos]"/>:
17+
</p>
18+
<blockquote style="border-left: 3px solid #ccc;padding-left: 15px;">
19+
<p>
20+
For a pack of subexpressions `domains`, <tt><i>COMMON-DOMAIN</i>(domains...)</tt> is expression-equivalent
21+
to <tt>common_type_t&lt;decltype(auto(domains))...&gt;()</tt> if that expression is well-formed, and
22+
<tt>indeterminate_domain&lt;Ds...&gt;()</tt> otherwise, where `Ds` is the pack of types consisting of
23+
`decltype(auto(domains))...` with duplicate types removed.
24+
</p></blockquote>
25+
<p>
26+
My intention with this paragraph was that two domains such as below would have a <tt><i>COMMON-DOMAIN</i></tt>
27+
of `default_domain`:
28+
</p>
29+
<blockquote><pre>
30+
struct my_thread_pool_domain : std::execution::default_domain
31+
{};
32+
33+
struct my_parallel_runtime_domain : std::execution::default_domain
34+
{};
35+
36+
<i>using domain-t</i> = decltype(<i>COMMON-DOMAIN</i>(my_thread_pool_domain{}, my_parallel_runtime_domain{}));
37+
static_assert(std::same_as&lt;<i>domain-t</i>, default_domain>); // <span style="color:#C80000;font-weight:bold">FAILS</span>
38+
</pre></blockquote>
39+
<p>
40+
But that's not how `common_type_t` works. Even though both domains derive from `default_domain`,
41+
they do not have a common type as determined by `common_type_t`.
42+
<p/>
43+
We can patch this up easily enough: if <tt>common_type_t&lt;Domains...&gt;</tt> is ill-formed,
44+
we should check if <tt>common_type_t&lt;default_domain, Domains...&gt;</tt> is well-formed, this
45+
will correctly handle the case when all the domains are convertible to `default_domain`.
46+
</p>
47+
</discussion>
48+
49+
<resolution>
50+
<p>
51+
This wording is relative to <paper num="N5032"/> after application of the wording added by <paper num="P3826R5"/>.
52+
</p>
53+
54+
<ol>
55+
<li>
56+
<p>Modify <sref ref="[exec.snd.expos]"/> as indicated:</p>
57+
58+
<blockquote>
59+
<p>
60+
-6- For a pack of subexpressions `domains`, <tt><i>COMMON-DOMAIN</i>(domains...)</tt> is expression-equivalent to
61+
<tt>common_type_t&lt;decltype(auto(domains))...&gt;()</tt> if that expression is
62+
well-formed<del>,</del><ins>; otherwise, <tt>common_type_t&lt;default_domain(), decltype(auto(domains))...&gt;()</tt>
63+
if that expression is well-formed;</ins> and <tt>indeterminate_domain&lt;Ds...&gt;()</tt> otherwise, where
64+
`Ds` is the pack of types consisting of `decltype(auto(domains))...` with duplicate types removed.
65+
</p>
66+
</blockquote>
67+
</li>
68+
69+
</ol>
70+
</resolution>
71+
72+
</issue>

0 commit comments

Comments
 (0)