fix #3044 (Symbol database: handle multidim array with unknown dimension 'char a[][4]')

This commit is contained in:
Robert Reif 2011-08-28 11:40:55 -04:00
parent 2d952c65e4
commit cf6d04de74
2 changed files with 10 additions and 1 deletions

View File

@ -1324,7 +1324,7 @@ bool SymbolDatabase::arrayDimensions(std::vector<Dimension> &dimensions, const T
const Token *dim = tok;
while (dim && dim->next() && dim->str() == "[" && dim->next()->str() != "]")
while (dim && dim->next() && dim->str() == "[")
{
Dimension dimension;
dimension.num = 0;

View File

@ -108,6 +108,7 @@ private:
TEST_CASE(array_index_30); // ticket #2086 - out of bounds when type is unknown
TEST_CASE(array_index_31); // ticket #2120 - out of bounds in subfunction when type is unknown
TEST_CASE(array_index_32);
TEST_CASE(array_index_33); // ticket #3044
TEST_CASE(array_index_multidim);
TEST_CASE(array_index_switch_in_for);
TEST_CASE(array_index_for_in_for); // FP: #2634
@ -1080,6 +1081,14 @@ private:
TODO_ASSERT_EQUALS("[test.cpp:7]: (error) Array 'm_x[1]' index 1 out of bounds\n","", errout.str());
}
void array_index_33()
{
check("void foo(char bar[][4]) {\n"
" baz(bar[5]);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
void array_index_multidim()
{
check("void f()\n"