Fixed #1967 (Tokenizer::setVarid doesn't set variable value (list of function pointers))

This commit is contained in:
Daniel Marjamäki 2010-08-23 20:15:02 +02:00
parent 3b716dfcc9
commit f7063bed7c
2 changed files with 18 additions and 0 deletions

View File

@ -2832,6 +2832,13 @@ void Tokenizer::setVarId()
{
while (tok2 && (tok2->isName() || tok2->isNumber() || tok2->str() == "*" || tok2->str() == "&" || tok2->str() == ","))
tok2 = tok2->next();
if (tok2->str() == "(")
{
tok2 = tok2->link()->next();
if (tok2->str() == "(")
tok2 = tok2->link()->next();
again = true;
}
}
}
while (again);

View File

@ -148,6 +148,7 @@ private:
TEST_CASE(varid23);
TEST_CASE(varid24);
TEST_CASE(varid25);
TEST_CASE(varid26); // ticket #1967 (list of function pointers)
TEST_CASE(varidStl);
TEST_CASE(varid_delete);
TEST_CASE(varid_functions);
@ -2395,6 +2396,16 @@ private:
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
}
void varid26()
{
const std::string code("list<int (*)()> functions;\n");
const std::string expected("\n\n##file 0\n"
"1: list < int ( * ) ( ) > functions@1 ;\n");
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
}
void varidStl()
{