Title
Hardening `simd::vec::operator[]`
Status
new
Section
[simd.subscr] [simd.mask.subscr]
Submitter
Hewill Kang

Created on 2025-10-07.00:00:00 last changed 2 days ago

Messages

Date: 2025-10-11.11:17:06

Proposed resolution:

This wording is relative to N5014.

  1. Modify [simd.subscr] as indicated:

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

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

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

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

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

Date: 2025-10-07.00:00:00

`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.

History
Date User Action Args
2025-10-11 11:17:06adminsetmessages: + msg15147
2025-10-07 00:00:00admincreate