From 1407e6be3e77c5b6891d4224d9a425466268b130 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 27 Apr 2026 14:53:05 +0200 Subject: [PATCH 1/2] Update checkother.cpp --- lib/checkother.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 4628dd0d774..1584038f135 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1947,6 +1947,10 @@ void CheckOther::checkConstPointer() continue; if (mSettings->library.isFunctionConst(parent->astOperand2())) continue; + if (parent->astOperand2()->varId()) { + if (gparent->str() == "?" && astIsLHS(parent)) + continue; + } } } if (hasIncDecPlus) { From c4aaad9c4f2e2b489658cfdbfc80c1fb7b66f929 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 27 Apr 2026 14:53:58 +0200 Subject: [PATCH 2/2] Update testother.cpp --- test/testother.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/testother.cpp b/test/testother.cpp index 0b645a87ff0..5e3ae5e464d 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -4807,6 +4807,12 @@ class TestOther : public TestFixture { " return bar = 0;\n" "}\n"); ASSERT_EQUALS("", errout_str()); + + check("struct S { int x; };\n" // #14700 + "int f(S* s) {\n" + " return s->x ? 1 : 0;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:2:10]: (style) Parameter 's' can be declared as pointer to const [constParameterPointer]\n", errout_str()); } void constArray() {