diff --git a/lib/checkcondition.cpp b/lib/checkcondition.cpp index f40903fae..4d0ab6254 100644 --- a/lib/checkcondition.cpp +++ b/lib/checkcondition.cpp @@ -1285,6 +1285,10 @@ void CheckCondition::alwaysTrueFalse() const bool returnStatement = Token::simpleMatch(tok->astTop(), "return") && Token::Match(tok->astParent(), "%oror%|&&|return"); + // FIXME checking of return statements does not work well. See #8801 + if (returnStatement) + continue; + if (!(constIfWhileExpression || constValExpr || compExpr || returnStatement)) continue; diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 5f53c6944..828bd972c 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -2479,7 +2479,7 @@ private: " if(x == 0) { x++; return x == 0; } \n" " return false;\n" "}"); - ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:2]: (style) Condition 'x==0' is always false\n", errout.str()); + TODO_ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:2]: (style) Condition 'x==0' is always false\n", "", errout.str()); check("void f() {\n" // #6898 (Token::expressionString) " int x = 0;\n"