Fixed #965 (Division by zero false positive with nested macros)
This commit is contained in:
parent
41b2a52915
commit
531d0fa685
|
@ -3714,7 +3714,7 @@ bool Tokenizer::simplifyCalculations()
|
|||
continue;
|
||||
|
||||
// + and - are calculated after *
|
||||
if (Token::Match(tok->next(), "[+-]"))
|
||||
if (Token::Match(tok->next(), "[+-/]"))
|
||||
{
|
||||
if (tok->previous()->str() == "*")
|
||||
continue;
|
||||
|
|
|
@ -1758,6 +1758,7 @@ private:
|
|||
ASSERT_EQUALS("x = 1 + 2 * y ;", tok("x=1+2*y;"));
|
||||
ASSERT_EQUALS("x = 7 ;", tok("x=1+2*3;"));
|
||||
ASSERT_EQUALS("x = 47185 ;", tok("x=(65536*72/100);"));
|
||||
ASSERT_EQUALS("x = 900 ;", tok("x = 1500000 / ((145000 - 55000) * 1000 / 54000);"));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue