cplusplus/parallelism-ts

incorrect return type of static_simd_cast

mattkretz opened this issue · 2 comments

[parallel.simd.casts] p12 specifies the return type to be "simd<T, Abi> if either U is T or U and T are integral types that only differ in signedness". This rule is inconsistent wrt. char / signed char / unsigned char and wchar_t, char16_t, and char32_t. E.g. static_simd_cast<char>(simd<signed char>()) produces a fixed_size ABI, instead of the compatible ABI as is the case for static_simd_cast<unsigned char>(simd<signed char>()).

Proposed resolution:

Modify 9.4.5/12

  • T if is_simd_v<T> is true, otherwise
  • simd<T, Abi> if either U is T or U and T are integral types that only differ in signednessmake_signed_t<U> is make_signed_t<T>, otherwise
  • simd<T, simd_abi::fixed_size<simd<U, Abi>::size()>>.

P1111r0 should deal with this. It was reported in an NB comment on the Parallelism TS v2 (CH15).

this is resolved after NB comments were applied