diff --git a/lib/checkcondition.cpp b/lib/checkcondition.cpp index 0a13a15d9..6f8339135 100644 --- a/lib/checkcondition.cpp +++ b/lib/checkcondition.cpp @@ -583,10 +583,10 @@ void CheckCondition::multiCondition2() tokens1.push(firstCondition->astOperand1()); tokens1.push(firstCondition->astOperand2()); } else if (!firstCondition->hasKnownValue()) { - if (isOppositeCond(false, mTokenizer->isCPP(), firstCondition, cond2, mSettings->library, true, false, &errorPath)) { + if (isOppositeCond(false, mTokenizer->isCPP(), firstCondition, cond2, mSettings->library, true, true, &errorPath)) { if (!isAliased(vars)) oppositeInnerConditionError(firstCondition, cond2, errorPath); - } else if (isSameExpression(mTokenizer->isCPP(), true, firstCondition, cond2, mSettings->library, true, false, &errorPath)) { + } else if (isSameExpression(mTokenizer->isCPP(), true, firstCondition, cond2, mSettings->library, true, true, &errorPath)) { identicalInnerConditionError(firstCondition, cond2, errorPath); } } @@ -603,7 +603,7 @@ void CheckCondition::multiCondition2() tokens2.push(secondCondition->astOperand1()); tokens2.push(secondCondition->astOperand2()); } else if ((!cond1->hasKnownValue() || !secondCondition->hasKnownValue()) && - isSameExpression(mTokenizer->isCPP(), true, cond1, secondCondition, mSettings->library, true, false, &errorPath)) { + isSameExpression(mTokenizer->isCPP(), true, cond1, secondCondition, mSettings->library, true, true, &errorPath)) { if (!isAliased(vars)) identicalConditionAfterEarlyExitError(cond1, secondCondition, errorPath); } diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 79382478d..8d89222a7 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -1601,7 +1601,7 @@ private: " if(!b) {}\n" " }\n" "}"); - // ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:4]: (warning) Opposite inner 'if' condition leads to a dead code block.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:4]: (warning) Opposite inner 'if' condition leads to a dead code block.\n", errout.str()); check("void foo(unsigned u) {\n" " if (u != 0) {\n"