<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/91385>91385</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
libc++ iota constructor check hardened mode
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
gonzalobg
</td>
</tr>
</table>
<pre>
@ldionne do you think that checking in `iota_view` constructor whether "bound is reachable from value" (pre-condition) would be a suitable check for hardened mode?
That would catch synthetic cases like:
```c++
iota(10, 5);
```
but also more common cases like:
```c++
iota(0, (int)vec.size());
```
where `(int)vec.size()` wraps around and ends up negative.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyckt1q5DgQhZ-mfFOkkct2277wRbKhn2DvF1kqW9rIUqOfbpKnX-zeIcnAMDBQ2CB0Th1VfTIlu3rmCboX6F4rWbIJcVqD_5AuzGs1B_0-QSuctsF7Rh3wPRTMxvo3zEZmVIbVm_UrWo9wFjZk-c_N8h3OAlXwKceicoh4N5wNRwSiORSv0SaMLJWRs2NcYtjwJl1hIEKg4Rr5SQWvbbbBA414D8VpnBklpmLzoTp64xIiGhk1e9a4Bc3QXEC8gnh-fP_eYz7kSmZlML37bDhbhUomTujsG0Pz_FUDZ_EoBfSy13G6Pw5oqAXQX9gBjdC8_HT_q8lcMkqXAm4hMqqwbcH_YcujI9BgfQYab6xOyX4w0LCH-F2Ou-HI-3J-ZXAWeI_ymlDGYzXSa2SvE5Yrel5ltjc-VXpq9NiMsuKp7uuursXY95WZzrqlQQ9d0wmeZ6oHsfQ9DVKflVz6pa3sRIJa0Ym-Hlvq-tPcDuOixND0S0uyH6AVvEnrTs7dtlOIa2VTKjyNdTN0lZMzu3QgSuTs_GM-RDuycdpFT3NZ086pTTl92mSbHU-fGtzH-Q3LB0Lf8KlKdJPJ-Zr2DdEF6LLabMp8UmEDuuzu__-erjH8yyoDXY7ECehyhP4vAAD__3RhBZ4">