You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -986,6 +984,27 @@ class TestStl : public TestFixture {
986
984
" return sv[sv.size()] == '\\0';\n"
987
985
"}\n");
988
986
ASSERT_EQUALS("[test.cpp:2:12]: error: Out of bounds access of sv, index 'sv.size()' is out of bounds. [containerOutOfBoundsIndexExpression]\n", errout_str());
987
+
check("void f(){\n"
988
+
" std::vector<double> v = {0.0, 0.1};\n"
989
+
" (void)v[0];\n"
990
+
"}\n");
991
+
ASSERT_EQUALS("", errout_str());
992
+
993
+
994
+
check("void f(){\n"
995
+
" std::array<int,2> a = {1,2};\n"
996
+
" (void)a[1];\n"
997
+
"}\n");
998
+
ASSERT_EQUALS("", errout_str());
999
+
1000
+
1001
+
check("void f(){\n"
1002
+
" std::vector<int> v;\n"
1003
+
" v.push_back(42);\n"
1004
+
" (void)v[0];\n"
1005
+
"}\n");
1006
+
ASSERT_EQUALS("", errout_str());
1007
+
989
1008
}
990
1009
voidoutOfBoundsIterator() {
991
1010
check("int f() {\n"
@@ -7205,36 +7224,7 @@ class TestStl : public TestFixture {
7205
7224
"}\n");
7206
7225
ASSERT_EQUALS("", errout_str());
7207
7226
}
7208
-
// Regression guards: non-empty containers must NOT trigger containerOutOfBounds (2025-08-12)
0 commit comments