diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 6b4386231..850432296 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1153,7 +1153,7 @@ static void valueFlowSameExpressions(TokenList *tokenlist) if (tok->astOperand1()->isLiteral() || tok->astOperand2()->isLiteral()) continue; - if (astIsFloat(tok->astOperand1(), true) || astIsFloat(tok->astOperand2(), true)) + if (!astIsIntegral(tok->astOperand1(), false) && !astIsIntegral(tok->astOperand2(), false)) continue; ValueFlow::Value val; diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 9a40e0a21..f4296e319 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -2774,6 +2774,17 @@ private: check("void f(const int a[]){ if (a == 0){} }"); ASSERT_EQUALS("", errout.str()); + + check("struct S {\n" + " bool operator<(const S&);\n" + "};\n" + "int main() {\n" + " S s;\n" + " bool c = s