diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index d80c68c97..c3ab6d0fb 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -816,7 +816,7 @@ bool TemplateSimplifier::simplifyCalculations(Token *_tokens) if (tok->isNumber()) { // Remove redundant conditions (0&&x) (1||x) if (Token::Match(tok->previous(), "[(=,] 0 &&") || - Token::Match(tok->previous(), "[(=,] 1 ||")) { + Token::Match(tok->previous(), "[(=,] 1 %oror%")) { unsigned int par = 0; const Token *tok2 = tok; for (; tok2; tok2 = tok2->next()) { diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 5cb7370ef..292758fae 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5653,7 +5653,7 @@ bool Tokenizer::simplifyLogicalOperators() } else if (Token::Match(tok, "&& not|compl %var%")) { tok->next()->str(tok->next()->str() == "not" ? "!" : "~"); ret = true; - } else if (Token::Match(tok, "|| not|compl %var%")) { + } else if (Token::Match(tok, "%oror% not|compl %var%")) { tok->next()->str(tok->next()->str() == "not" ? "!" : "~"); ret = true; }