File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,6 +176,10 @@ class TestStl : public TestFixture {
176176
177177 TEST_CASE (checkKnownEmptyContainer);
178178 TEST_CASE (checkMutexes);
179+ TEST_CASE (coob_initlist_vector_nonempty_no_fp_regression_20250812);
180+ TEST_CASE (coob_array_initlist_nonempty_no_fp_regression_20250812);
181+ TEST_CASE (coob_vector_pushback_nonempty_no_fp_regression_20250812);
182+
179183 }
180184
181185 struct CheckOptions
@@ -7201,6 +7205,36 @@ class TestStl : public TestFixture {
72017205 " }\n " );
72027206 ASSERT_EQUALS (" " , errout_str ());
72037207 }
7208+ // Regression guards: non-empty containers must NOT trigger containerOutOfBounds (2025-08-12)
7209+
7210+
7211+ void coob_initlist_vector_nonempty_no_fp_regression_20250812 ()
7212+ {
7213+ check (
7214+ " #include <vector>\n "
7215+ " void f(){ std::vector<double> v{0.0, 0.1}; (void)v[0]; }\n "
7216+ );
7217+ ASSERT_EQUALS (" " , errout_str ());
7218+ }
7219+
7220+ void coob_array_initlist_nonempty_no_fp_regression_20250812 ()
7221+ {
7222+ check (
7223+ " #include <array>\n "
7224+ " void f(){ std::array<int,2> a{1,2}; (void)a[1]; }\n "
7225+ );
7226+ ASSERT_EQUALS (" " , errout_str ());
7227+ }
7228+
7229+ void coob_vector_pushback_nonempty_no_fp_regression_20250812 ()
7230+ {
7231+ check (
7232+ " #include <vector>\n "
7233+ " void f(){ std::vector<int> v; v.push_back(42); (void)v[0]; }\n "
7234+ );
7235+ ASSERT_EQUALS (" " , errout_str ());
7236+ }
7237+
72047238};
72057239
72067240REGISTER_TEST (TestStl)
You can’t perform that action at this time.
0 commit comments