diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index ac85384ad..681521d6c 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -2926,8 +2926,10 @@ struct ExpressionAnalyzer : SingleValueFlowAnalyzer { assert(e && e->exprId() != 0 && "Not a valid expression"); dependOnThis = exprDependsOnThis(expr); setupExprVarIds(expr); - if (val.isSymbolicValue()) + if (val.isSymbolicValue()) { + dependOnThis |= exprDependsOnThis(val.tokvalue); setupExprVarIds(val.tokvalue); + } } static bool nonLocal(const Variable* var, bool deref) { diff --git a/test/testcondition.cpp b/test/testcondition.cpp index de2727299..71305295b 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -4483,6 +4483,20 @@ private: "}"); ASSERT_EQUALS("", errout.str()); + // #11100 + check("struct T {\n" + " bool m{};\n" + " void f(bool b);\n" + " bool get() const { return m; }\n" + " void set(bool v) { m = v; }\n" + "};\n" + "void T::f(bool b) {\n" + " bool tmp = get();\n" + " set(b);\n" + " if (tmp != get()) {}\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + // #9541 check("int f(int pos, int a) {\n" " if (pos <= 0)\n"