Fixed #2632 (segmentation fault of cppcheck ( void>(); void>() ))

This commit is contained in:
Daniel Marjamäki 2011-03-09 21:25:44 +01:00
parent bea3875386
commit 5a0ec56fc2
2 changed files with 5 additions and 0 deletions

View File

@ -8723,6 +8723,9 @@ void Tokenizer::simplifyComparisonOrder()
{
if (!tok->next()->isName() && !tok->next()->isNumber())
continue;
const Token *operand2 = tok->tokAt(3);
if (!operand2->isName() && !operand2->isNumber())
continue;
const std::string op1(tok->strAt(1));
tok->next()->str(tok->strAt(3));
tok->tokAt(3)->str(op1);

View File

@ -4598,6 +4598,8 @@ private:
{
ASSERT_EQUALS("( i < 10 )", tokenizeAndStringify("(10>i)"));
ASSERT_EQUALS("; i < 10 ;", tokenizeAndStringify(";10>i;"));
ASSERT_EQUALS("void > ( ) ; void > ( )",
tokenizeAndStringify("void>(); void>()"));
}