File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ <?xml version =' 1.0' encoding =' utf-8' standalone =' no' ?>
2+ <!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+ <issue num =" 4276" status =" New" >
5+ <title >`front()` and `back()` are not hardened for zero-length `std::array`s</title >
6+ <section >
7+ <sref ref =" [array.zero]" />
8+ </section >
9+ <submitter >Jan Schultke</submitter >
10+ <date >08 Jun 2025</date >
11+ <priority >99</priority >
12+
13+ <discussion >
14+ <p >
15+ The intent of <paper num =" P3471" /> "Standard library hardening" is clearly to provide hardened preconditions
16+ for members of sequence containers, including `std::array`. However, a zero-length `std::array` dodges this
17+ hardening by having undefined behavior for `front()` and `back()` explicitly specified in
18+ <sref ref =" [array.zero]" /> paragraph 3.
19+ <p />
20+ Without this paragraph, `front()` and `back()` would be hardened as well, as specified in <sref ref =" [sequence.reqmts]" />.
21+ </p >
22+ </discussion >
23+
24+ <resolution >
25+ <p >
26+ This wording is relative to <paper num =" N5008" />.
27+ </p >
28+
29+ <ol >
30+ <li ><p >Modify <sref ref =" [array.zero]" /> as indicated:</p >
31+
32+ <blockquote >
33+ <p >
34+ <del >-3- The effect of calling `front()` or `back()` for a zero-sized array is undefined.</del >
35+ </p >
36+ </blockquote >
37+ </li >
38+
39+ </ol >
40+ </resolution >
41+
42+ </issue >
You can’t perform that action at this time.
0 commit comments