diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 2be550f5f..c7ee59a0a 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5982,7 +5982,8 @@ bool Tokenizer::simplifyKnownVariables() } // Variable is used in calculation.. - if (Token::Match(tok3, "[=+-*/[] %varid% [=?+-*/;])]", varid) || + if (((tok3->previous()->varId() > 0) && Token::Match(tok3, "& %varid%", varid)) || + Token::Match(tok3, "[=+-*/[] %varid% [=?+-*/;])]", varid) || Token::Match(tok3, "[(=+-*/[] %varid% <<|>>", varid) || Token::Match(tok3, "<< %varid% [+-*/;])]", varid) || Token::Match(tok3, ">> %varid% [+-*/;])]", varid) || diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 3a7573303..540d28be7 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -1598,7 +1598,7 @@ private: "4:\n" "5: return u@1 & v@2 ;\n" "6: }\n"; - TODO_ASSERT_EQUALS(expected, tokenizeDebugListing(code, true)); + ASSERT_EQUALS(expected, tokenizeDebugListing(code, true)); } {