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.

4408. Hardening simd::vec::operator[]

Section: 29.10.7.3 [simd.subscr], 29.10.9.3 [simd.mask.subscr] Status: LEWG Submitter: Hewill Kang Opened: 2025-10-07 Last modified: 2025-10-22

Priority: 3

View all issues with LEWG status.

Discussion:

simd::vec::operator[] satisfies the criteria in P3471R4 and P3697R1 : "violating the precondition results in a memory safety issue", which means that hardening is reasonable.

[2025-10-22; Reflector poll. Status changed: New → LEWG and P3.]

Proposed resolution:

This wording is relative to N5014.

  1. Modify 29.10.7.3 [simd.subscr] as indicated:

    constexpr value_type operator[](simd-size-type i) const;
    

    -1- Hardened Ppreconditions: i >= 0 && i < size() is true.

  2. Modify 29.10.9.3 [simd.mask.subscr] as indicated:

    constexpr value_type operator[](simd-size-type i) const;
    

    -1- Hardened Ppreconditions: i >= 0 && i < size() is true.