From 55fc473a00ad6b083bd6207e51c8f3b81c9578f7 Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Tue, 15 Sep 2009 23:38:54 +0300 Subject: [PATCH] Fix #684 (Tokenizer: (65536*72/100) incorrectly simplified to zero) http://sourceforge.net/apps/trac/cppcheck/ticket/684 --- src/tokenize.cpp | 2 +- test/testsimplifytokens.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tokenize.cpp b/src/tokenize.cpp index 7d4acd78b..cb66adf99 100644 --- a/src/tokenize.cpp +++ b/src/tokenize.cpp @@ -3164,7 +3164,7 @@ bool Tokenizer::simplifyCalculations() } // (1-2) - if (Token::Match(tok, "[[,(=<>+-*] %num% [+-*/] %num% [],);=<>+-*]")) + if (Token::Match(tok, "[[,(=<>+-*] %num% [+-*/] %num% [],);=<>+-*/]")) { tok = tok->next(); diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 2588f1ea4..75162c83c 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -1420,6 +1420,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);")); }