diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 493375a9f..93ffbd5b7 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -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; diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 4f46493b3..c4cd724d2 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -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);")); }