diff --git a/lib/astutils.cpp b/lib/astutils.cpp index fa9ffc00edf..2c8efaa31f3 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -2955,7 +2955,7 @@ static const Token* findExpressionChangedImpl(const Token* expr, global = true; } - if (tok->exprId() > 0) { + if (tok->exprId() > 0 || global) { const Token* modifedTok = find(start, end, [&](const Token* tok2) { int indirect = 0; if (const ValueType* vt = tok->valueType()) { diff --git a/test/testother.cpp b/test/testother.cpp index 4f12bf4f622..7c61270d108 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -5619,6 +5619,14 @@ class TestOther : public TestFixture { " i = b[idx];\n" "};\n"); ASSERT_EQUALS("", errout.str()); + + check("void g(int*);\n" // #12390 + "void f() {\n" + " int o = s.i;\n" + " g(&s.i);\n" + " s.i = o;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void trac1132() {