Tokenizer: Fixed calculation simplification of '0*(*p)'. Ticket: #2348
This commit is contained in:
parent
aff3623fec
commit
472ecd8805
|
@ -6607,6 +6607,8 @@ bool Tokenizer::simplifyCalculations()
|
|||
else if (Token::Match(tok->previous(), "[=[(,] 0 * %any% [+-*/,]);]"))
|
||||
{
|
||||
tok->deleteNext();
|
||||
if (tok->next()->str() == "(")
|
||||
Token::eraseTokens(tok, tok->next()->link());
|
||||
tok->deleteNext();
|
||||
ret = true;
|
||||
}
|
||||
|
|
|
@ -2566,6 +2566,8 @@ private:
|
|||
ASSERT_EQUALS("void * operator new [ ] ( size_t ) ;", tok(code));
|
||||
}
|
||||
|
||||
ASSERT_EQUALS("; a [ 0 ] ;", tok(";a[0*(*p)];"));
|
||||
|
||||
ASSERT_EQUALS(";", tok("; x = x + 0;"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue