#4750 Added a regression test

This commit is contained in:
orbitcowboy 2021-03-28 09:29:46 +02:00
parent 185a5e1ee6
commit e23a967215
1 changed files with 13 additions and 0 deletions

View File

@ -133,6 +133,7 @@ private:
TEST_CASE(array_index_50);
TEST_CASE(array_index_51); // #3763
TEST_CASE(array_index_52); // #7682
TEST_CASE(array_index_53); // #4750
TEST_CASE(array_index_multidim);
TEST_CASE(array_index_switch_in_for);
TEST_CASE(array_index_for_in_for); // FP: #2634
@ -1546,6 +1547,18 @@ private:
ASSERT_EQUALS("[test.cpp:5]: (error) Array 'buf[10]' accessed at index 10, which is out of bounds.\n", errout.str());
}
void array_index_53() {
check("double M[3][1];\n"
" \n"
"void matrix()\n"
"{\n"
" for (int i=0; i < 3; i++)\n"
" for (int j = 0; j < 3; j++)\n"
" M[i][j]=0.0;\n"
"}");
ASSERT_EQUALS("[test.cpp:7]: (error) Array 'M[3][1]' accessed at index M[*][2], which is out of bounds.\n", errout.str());
}
void array_index_multidim() {
check("void f()\n"
"{\n"