[PATCH] libstdc++: Implement LWG4403: CTAD misses difference type casting

Hewill Kang hewillk@gmail.com
Tue Apr 14 14:27:53 GMT 2026


LGTM.
But your __static_sized_range already blocks integer-class types, so this
doesn't make any real difference, does it?

Matthias Kretz <MatthiasKretz@gmx.net> 於 2026年4月14日週二 下午9:02寫道:

> From: Matthias Kretz <m.kretz@gsi.de>
>
> libstdc++-v3/ChangeLog:
>
>         * include/bits/simd_vec.h (basic_vec deduction guide): Explicit
>         cast to simd-size-type from range size type.
>
> Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
> ---
>  libstdc++-v3/include/bits/simd_vec.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libstdc++-v3/include/bits/simd_vec.h
> b/libstdc++-v3/include/bits/
> simd_vec.h
> index da194824e72..2574bf7c3ad 100644
> --- a/libstdc++-v3/include/bits/simd_vec.h
> +++ b/libstdc++-v3/include/bits/simd_vec.h
> @@ -2264,9 +2264,9 @@ basic_vec(_Rg&& __range, flags<_Flags...> __flags =
> {})
>      -> basic_vec<ranges::range_value_t<_Rg>,
>                  __deduce_abi_t<ranges::range_value_t<_Rg>,
>  #if 0 // PR117849
> -                               ranges::size(__r)>>;
> +
> static_cast<__simd_size_type>(ranges::size(__r))>>;
>  #else
> -                               decltype(std::span(__r))::extent>>;
> +
> static_cast<__simd_size_type>(decltype(std::span(__r))::extent)>>;
>  #endif
>
>    template <size_t _Bytes, typename _Ap>
> --
> ──────────────────────────────────────────────────────────────────────────
>  Dr. Matthias Kretz                           https://mattkretz.github.io
>  GSI Helmholtz Center for Heavy Ion Research               https://gsi.de
>  std::simd
> ──────────────────────────────────────────────────────────────────────────
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20260414/5a014547/attachment.htm>


More information about the Libstdc++ mailing list