This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of LEWG status.

4390. simd::basic_vec(U&&) default template parameter

Section: 29.10.7.2 [simd.ctor] Status: LEWG Submitter: Hewill Kang Opened: 2025-09-29 Last modified: 2025-10-22

Priority: 4

View other active issues in [simd.ctor].

View all other issues in [simd.ctor].

View all issues with LEWG status.

Discussion:

simd::basic_vec supports complex after P2663R7, defaulting the template parameter of its broadcast constructor seems to be reasonable, as this allows the intuitive spelling:

simd::vec<complex<double>> sc1   ({-1.0, 0.5}); // current ill-formed
simd::vec<complex<double>> sc2 = {{-1.0, 0.5}}; // current ill-formed

[2025-10-22; Reflector poll. Status changed: New → LEWG with priority 4.]

This narrows design space wrt using braces for initialization of basic_vec, especially if we allow user-defined types.

LWG 4230(i) would address this by allowing vec<complex<double>>(1., 1.);

Proposed resolution:

This wording is relative to N5014.

  1. Modify 29.10.7.1 [simd.overview] as indicated:

    namespace std::simd {
      template<class T, class Abi> class basic_vec {
      public:
        […]
        template<class U = T>
          constexpr explicit(see below) basic_vec(U&& value) noexcept;
        […]
      };
    }
    
  2. Modify 29.10.7.2 [simd.ctor] as indicated:

    template<class U = T> constexpr explicit(see below) basic_vec(U&& value) noexcept;
    

    -1- […]