P4012R0 — value-preserving consteval broadcast to simd::vec (6 items) LEWG, LWG
Matthias Kretz
This paper proposes adding a consteval broadcast constructor overload to std::simd's basic_vec that enables value-preserving implicit conversions from arithmetic types like int, restoring behavior from the Parallelism 2 TS that was lost in the C++26 Committee Draft. The consteval overload is constrained to types that are not already value-preserving-convertible to the target type, and uses constexpr exceptions to make value-changing conversions ill-formed at compile time. A secondary alternative of simply removing explicit conversion on broadcast is also presented as a fallback to preserve design space for C++29.

References — Anthropic Citations API

[1]
"P4012R0 11 Wording for removing explicit conversion on broadcast 10.5 modify [simd.ctor] In [simd.ctore], change: [simd.ctor] template U> constexpr..."
[1]
"P4012R0 A really_convertible_to definition 11.3 modify [simd.ctor] In [simd.ctore], change: [simd.ctor] template constexpr explicit(see below) basic_vec(U&& value) noexcept; 5 Let..."
[2]
"P4012R0 11 Wording for removing explicit conversion on broadcast 10.5 modify [simd.ctor] In [simd.ctore], change: [simd.ctor] template U> constexpr..."
[2]
"P4012R0 A really_convertible_to definition 11.3 modify [simd.ctor] In [simd.ctore], change: [simd.ctor] template constexpr explicit(see below) basic_vec(U&& value) noexcept; 5 Let..."
[3]
"template U> consteval basic_vec(U&& x) template"
[4]
"template U> consteval basic_vec(U&& x) -?- Preconditions: The value of x is equal to the value of x after conversion to value_type. "
[5]
"However, V(0x5EAF00D) is shorter and needs fewer template instantations."
[6]
"a basic_vec broadcast constructor (with it's helper types/concepts to determine whether the specialization is allowed)"
Summary: P4012R0 proposes making the broadcast constructor of simd::basic_vec a consteval function so that narrowing or non-value-preserving conversions from scalar to vector element type are diagnosed at compile time rather than silently truncating. It also removes the explicit qualifier from the broadcast constructor for consteval-safe argument types. Six defects were found in the proposed wording and motivational text.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.