Skip to content

Commit 7de5296

Browse files
Update teststl.cpp
1 parent 3649446 commit 7de5296

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/teststl.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,14 @@ class TestStl : public TestFixture {
972972
"bool g() { return f(\" \"); }\n");
973973
ASSERT_EQUALS("[test.cpp:1:44]: error: Out of bounds access in 's[500]', if 's' size is 1 and '500' is 500 [containerOutOfBounds]\n",
974974
errout_str());
975+
976+
checkNormal("int main() {\n" // #14342
977+
" const int a[] = { 1, 2, 3 };\n"
978+
" std::span<const int> x{ a };\n"
979+
" return x[3];\n"
980+
"}\n");
981+
ASSERT_EQUALS("[test.cpp:4:13]: error: Out of bounds access in 'x[3]', if 'x' size is 1 and '3' is 3 [containerOutOfBounds]\n",
982+
errout_str());
975983
}
976984

977985
void outOfBoundsSymbolic()

0 commit comments

Comments
 (0)