From 834a4bd2cfe5be496df4ec9e9df2f7c82846f19f Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:01:04 +0100 Subject: [PATCH 1/3] Update checkother.cpp --- lib/checkother.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 5f98d376a91..df118ce81be 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -2147,7 +2147,7 @@ void CheckOtherImpl::checkConstPointer() // continue; if (!isConstPointerVariable(p, mSettings)) continue; - if (p->typeStartToken() && p->typeStartToken()->isSimplifiedTypedef() && !(Token::simpleMatch(p->typeEndToken(), "*") && !p->typeEndToken()->isSimplifiedTypedef())) + if (p->typeStartToken() && p->typeStartToken()->isSimplifiedTypedef() && Token::simpleMatch(p->typeEndToken(), "*") && p->typeEndToken()->isSimplifiedTypedef()) continue; constVariableError(p, p->isArgument() ? p->scope()->function : nullptr, foundAllBaseClasses); } From 33874384b0e02ff0dcd543ed6aa23e3f8f398638 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:02:19 +0100 Subject: [PATCH 2/3] Update testother.cpp --- test/testother.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/testother.cpp b/test/testother.cpp index 32a09055d65..a194c297a8b 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -4249,6 +4249,14 @@ class TestOther : public TestFixture { " return &(u.i);\n" "}\n"); ASSERT_EQUALS("", errout_str()); + + check("typedef int I;\n" // #15167 + "I f() {\n" + " I a[1] = { 0 };\n" + " return a[0];\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:3:7]: (style) Variable 'a' can be declared as const array [constVariable]\n", + errout_str()); } void constParameterCallback() { From 63bf235ec60c9f69b64e998aeabc41447656bbb0 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:13:16 +0100 Subject: [PATCH 3/3] Update windows.cpp --- test/cfg/windows.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cfg/windows.cpp b/test/cfg/windows.cpp index 37c580a0134..689fd425604 100644 --- a/test/cfg/windows.cpp +++ b/test/cfg/windows.cpp @@ -884,7 +884,7 @@ void uninitvar() // cppcheck-suppress uninitvar lstrcat(buf, _T("test")); buf[0] = _T('\0'); - // TODO cppcheck-suppress constVariable + // cppcheck-suppress constVariable TCHAR buf2[2]; // cppcheck-suppress lstrcatCalled // cppcheck-suppress uninitvar