Fix #684 (Tokenizer: (65536*72/100) incorrectly simplified to zero)
http://sourceforge.net/apps/trac/cppcheck/ticket/684
This commit is contained in:
parent
5efedf85d6
commit
55fc473a00
|
@ -3164,7 +3164,7 @@ bool Tokenizer::simplifyCalculations()
|
||||||
}
|
}
|
||||||
|
|
||||||
// (1-2)
|
// (1-2)
|
||||||
if (Token::Match(tok, "[[,(=<>+-*] %num% [+-*/] %num% [],);=<>+-*]"))
|
if (Token::Match(tok, "[[,(=<>+-*] %num% [+-*/] %num% [],);=<>+-*/]"))
|
||||||
{
|
{
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
||||||
|
|
|
@ -1420,6 +1420,7 @@ private:
|
||||||
|
|
||||||
ASSERT_EQUALS("x = 1 + 2 * y ;", tok("x=1+2*y;"));
|
ASSERT_EQUALS("x = 1 + 2 * y ;", tok("x=1+2*y;"));
|
||||||
ASSERT_EQUALS("x = 7 ;", tok("x=1+2*3;"));
|
ASSERT_EQUALS("x = 7 ;", tok("x=1+2*3;"));
|
||||||
|
ASSERT_EQUALS("x = 47185 ;", tok("x=(65536*72/100);"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue