From 13e6df3f7ecb9576c5ff5c225a1cd533cf62e6dd Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Wed, 11 Nov 2026 09:07:49 +0100 Subject: [PATCH 1/2] Update astutils.cpp --- lib/astutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/astutils.cpp b/lib/astutils.cpp index e2e19b6bd91..0f253930248 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -2794,7 +2794,7 @@ bool isVariableChanged(const Token *tok, int indirect, const Settings &settings, const Token * ptok = tok2; while (Token::Match(ptok->astParent(), ".|::")) ptok = ptok->astParent(); - int pindirect = indirect; + int pindirect = indirect - derefs; if (indirect == 0 && astIsLHS(tok2) && Token::Match(ptok, ". %var%") && astIsPointer(ptok->next())) pindirect = 1; bool inconclusive = false; From 63dda398dfd08762f9210c337664fd18f8765203 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Wed, 11 Nov 2026 09:08:44 +0100 Subject: [PATCH 2/2] Update testother.cpp --- test/testother.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/testother.cpp b/test/testother.cpp index adfc2ff0f2a..c58aef2650e 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -5086,6 +5086,11 @@ class TestOther : public TestFixture { "void g(__attribute__((unused)) int *p) {}\n" "void h(int *p) {}\n"); ASSERT_EQUALS("[test.cpp:3:13]: (style) Parameter 'p' can be declared as pointer to const [constParameterPointer]\n", errout_str()); + + check("void f(std::vector& v, int* p) {\n" // #15203 + " v.push_back(*p);\n" + "};\n"); + ASSERT_EQUALS("[test.cpp:1:34]: (style) Parameter 'p' can be declared as pointer to const [constParameterPointer]\n", errout_str()); } void constArray() {