Skip to content

Commit e9a16a5

Browse files
committed
New issue from Hewill: "simd::basic_vec CTAD misses difference type casting"
1 parent 4b5d1c6 commit e9a16a5

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

xml/issue4403.xml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4403" status="New">
5+
<title>`simd::basic_vec` CTAD misses difference type casting</title>
6+
<section>
7+
<sref ref="[simd.ctor]"/>
8+
</section>
9+
<submitter>Hewill Kang</submitter>
10+
<date>04 Oct 2025</date>
11+
<priority>99</priority>
12+
13+
<discussion>
14+
<p>
15+
Currently, `basic_vec` can take an object `r` of range type `R` whose size is a
16+
constant expression and deduced to <code>vec&lt;ranges::range_value_t&lt;R&gt;, ranges::size(r)&gt;</code>.
17+
<p/>
18+
However, such a deduced type is ill-formed when `R` has a an integer-class type size which cannot
19+
be implicitly converted to <code><i>simd-size-type</i></code>, which is a signed integer type.
20+
<p/>
21+
It is necessary to perform difference type casting here, and the narrowing
22+
conversion will still correctly be rejected due to the constructor's constraints.
23+
</p>
24+
</discussion>
25+
26+
<resolution>
27+
<p>
28+
This wording is relative to <paper num="N5014"/>.
29+
</p>
30+
31+
<ol>
32+
33+
<li><p>Modify <sref ref="[simd.ctor]"/> as indicated:</p>
34+
35+
<blockquote>
36+
<pre>
37+
template&lt;class R, class... Ts&gt;
38+
basic_vec(R&amp;&amp; r, Ts...) -&gt; <i>see below</i>;
39+
</pre>
40+
<blockquote>
41+
<p>
42+
-17- <i>Constraints</i>:
43+
</p>
44+
<ol style="list-style-type: none">
45+
<li><p>
46+
(17.1) &mdash; `R` models `ranges::contiguous_range` and `ranges::sized_range`, and
47+
</p></li>
48+
<li><p>
49+
(17.2) &mdash; `ranges::size(r)` is a constant expression.
50+
</p></li>
51+
</ol>
52+
<p>
53+
-18- <i>Remarks</i>: The deduced type is equivalent to <code>
54+
vec&lt;ranges::range_value_t&lt;R&gt;, <ins>static_cast&lt;<i>simd-size-type</i>&gt;(</ins>ranges::size(r)<ins>)</ins>&gt;
55+
</code>
56+
</p>
57+
</blockquote>
58+
</blockquote>
59+
</li>
60+
61+
</ol>
62+
63+
</resolution>
64+
65+
</issue>

0 commit comments

Comments
 (0)