Array index out of bounds: Added test case for #3428 (same name of structs)
This commit is contained in:
parent
1ba1be4b8d
commit
7c95c6f680
|
@ -1331,6 +1331,17 @@ private:
|
||||||
" struct Fred { char data[3]; } fred;\n"
|
" struct Fred { char data[3]; } fred;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("void a() {\n"
|
||||||
|
" struct Fred { char data[6]; } fred;\n"
|
||||||
|
" fred.data[4] = 0;\n" // <- no error
|
||||||
|
"}\n"
|
||||||
|
"\n"
|
||||||
|
"void b() {\n"
|
||||||
|
" struct Fred { char data[3]; } fred;\n"
|
||||||
|
" fred.data[4] = 0;\n" // <- error
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("[test.cpp:8]: (error) Array 'fred.data[3]' index 4 out of bounds\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void array_index_multidim() {
|
void array_index_multidim() {
|
||||||
|
|
Loading…
Reference in New Issue