Title
`simd::basic_vec` CTAD misses difference type casting
Status
wp
Section
[simd.ctor]
Submitter
Hewill Kang

Created on 2025-10-04.00:00:00 last changed 5 days ago

Messages

Date: 2025-11-11.10:48:16

Proposed resolution:

This wording is relative to N5014.

  1. Modify [simd.ctor] as indicated:

    template<class R, class... Ts>
      basic_vec(R&& r, Ts...) -> see below;
    

    -17- Constraints:

    1. (17.1) — `R` models `ranges::contiguous_range` and `ranges::sized_range`, and

    2. (17.2) — `ranges::size(r)` is a constant expression.

    -18- Remarks: The deduced type is equivalent to vec<ranges::range_value_t<R>, static_cast<simd-size-type>(ranges::size(r))>

Date: 2025-11-11.10:48:16

[ Kona 2025-11-08; Status changed: Voting → WP. ]

Date: 2025-10-15.00:00:00

[ 2025-10-17; Reflector poll ]

Set status to Tentatively Ready after six votes in favour during reflector poll.

Date: 2025-10-04.00:00:00

Currently, `basic_vec` can take an object `r` of range type `R` whose size is a constant expression and deduced to vec<ranges::range_value_t<R>, ranges::size(r)>.

However, such a deduced type is ill-formed when `R` has a an integer-class type size which cannot be implicitly converted to simd-size-type, which is a signed integer type.

It is necessary to perform difference type casting here, and the narrowing conversion will still correctly be rejected due to the constructor's constraints.

History
Date User Action Args
2025-11-11 10:48:16adminsetmessages: + msg15652
2025-11-11 10:48:16adminsetstatus: voting -> wp
2025-10-30 17:45:31adminsetstatus: ready -> voting
2025-10-17 11:00:25adminsetmessages: + msg15206
2025-10-17 11:00:25adminsetstatus: new -> ready
2025-10-04 14:28:02adminsetmessages: + msg15124
2025-10-04 00:00:00admincreate