Fixed #1827 (### Internal error in Cppcheck. Please report it.)

This commit is contained in:
Robert Reif 2010-07-06 08:26:30 +02:00 committed by Daniel Marjamäki
parent c949a29d1e
commit 1799e4a575
2 changed files with 8 additions and 1 deletions

View File

@ -1477,11 +1477,16 @@ void Tokenizer::simplifyTypedef()
// skip over name
if (tok2->next()->str() != ")")
{
if (tok2->next()->str() != "(")
tok2 = tok2->next();
// check for function and skip over args
if (tok2->next()->str() == "(")
tok2 = tok2->next()->link();
// check for array
if (tok2->next()->str() == "[")
tok2 = tok2->next()->link();
}
else
{

View File

@ -4128,6 +4128,7 @@ private:
"typedef char (& type3)[x];\n"
"typedef char (& type4)[x + 2];\n"
"type1 t1;\n"
"type1 (*tp1)[2];\n"
"type2 t2;\n"
"type3 t3;\n"
"type4 t4;";
@ -4135,6 +4136,7 @@ private:
// The expected result..
const std::string expected("; ; ; ; "
"char ( * t1 ) [ 10 ] ; "
"char ( * ( * tp1 ) [ 2 ] ) [ 10 ] ; "
"char ( & t2 ) [ 10 ] ; "
"char ( & t3 ) [ x ] ; "
"char ( & t4 ) [ x + 2 ] ;");