diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index dab952aa9a3..c8792a766d6 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -579,7 +579,6 @@ static bool isIntegralValue(const ValueFlow::Value& value) static ValueFlow::Value evaluate(const std::string& op, const ValueFlow::Value& lhs, const ValueFlow::Value& rhs) { ValueFlow::Value result; - combineValueProperties(lhs, rhs, result); if (lhs.isImpossible() && rhs.isImpossible()) return ValueFlow::Value::unknown(); if (lhs.isImpossible() || rhs.isImpossible()) { diff --git a/test/testcondition.cpp b/test/testcondition.cpp index db044308c71..d46a016072f 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -4988,6 +4988,22 @@ class TestCondition : public TestFixture { " if ((128 + i < 255 ? 128 + i : 255) > 0) {}\n" "}\n"); ASSERT_EQUALS("", errout_str()); + + check("struct S {\n" // #12727 + " bool f() const {\n" + " return g() > 0;\n" + " }\n" + " std::size_t g() const {\n" + " return 5 - h();\n" + " }\n" + " std::size_t h() const {\n" + " if (x > 7)\n" + " return 5;\n" + " return (5 + x) % 5;\n" + " }\n" + " std::size_t x;\n" + "};\n"); + ASSERT_EQUALS("", errout_str()); } void alwaysTrueContainer() {