This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
simd broadcast is overconstrained — std::cw<0.f> is not convertible to simd::vec<float16_t>Section: 29.10.7.2 [simd.ctor] Status: New Submitter: Matthias Kretz Opened: 2025-10-28 Last modified: 2025-10-31
Priority: Not Prioritized
View other active issues in [simd.ctor].
View all other issues in [simd.ctor].
View all issues with New status.
Discussion:
29.10.7.2 [simd.ctor] p4 requires all implicit conversions via broadcast
constructor to satisfy convertible_to<value_type>. However,
std::cw<0.f> is not convertible to float16_t because float
does not satisfy convertible_to<float16_t>. Consequently, with
the current wording we don't arrive at bullet (4.3) which allows
not-value-preserving conversions if the value is known to not change on conversion.
The convertible_to constraint is implicit in bullet (4.2), not needed/wrong for
bullet (4.3) and thus needs to be moved into bullet (4.1).
Proposed resolution:
This wording is relative to N5014.
Modify 29.10.7.2 [simd.ctor] as indicated:
template<class U> constexpr explicit(see below) basic_vec(U&& value) noexcept;-1- Let
-2- Constraints:Fromdenote the typeremove_cvref_t<U>.value_typesatisfiesconstructible_from<U>. -3- Effects: Initializes each element to the value of the argument after conversion tovalue_type. -4- Remarks: The expression inside explicit evaluates tofalseif and only ifeitherUsatisfiesconvertible_to<value_type>, and
- (4.1) —
Usatisfiesconvertible_to<value_type>andFromis not an arithmetic type and does not satisfyconstexpr-wrapper-like,- (4.2) —
Fromis an arithmetic type and the conversion fromFromtovalue_typeis value-preserving (29.10.1 [simd.general]), or- (4.3) —
Fromsatisfiesconstexpr-wrapper-like,remove_const_t<decltype(From::value)>is an arithmetic type, andFrom::valueis representable byvalue_type.