From b226506a339976c51f11cf69f78f7df8e6c35675 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Wed, 12 Aug 2026 08:55:47 +0200 Subject: [PATCH 1/2] Update checkassert.cpp --- lib/checkassert.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/checkassert.cpp b/lib/checkassert.cpp index 4578f7395ba..00bb95e319a 100644 --- a/lib/checkassert.cpp +++ b/lib/checkassert.cpp @@ -78,6 +78,11 @@ void CheckAssertImpl::assertWithSideEffects() continue; } + const Token* parent = tmp->astParent(); + while (Token::Match(parent, ".|::")) + parent = parent->astParent(); + if (!Token::simpleMatch(parent, "(")) + continue; const Function* f = tmp->function(); const Scope* scope = f->functionScope; if (!scope) { From ceb07fbec157c5dc5db8f61d1f1937bf1e80b0f2 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Wed, 12 Aug 2026 08:56:28 +0200 Subject: [PATCH 2/2] Update testassert.cpp --- test/testassert.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/testassert.cpp b/test/testassert.cpp index ea170c43f2d..a76b8207445 100644 --- a/test/testassert.cpp +++ b/test/testassert.cpp @@ -147,6 +147,17 @@ class TestAssert : public TestFixture { " assert(g());\n" "}\n"); ASSERT_EQUALS("", errout_str()); + + check("int i;\n" // #14973 + "bool f() {\n" + " i = 0;\n" + " return true;\n" + "}\n" + "void g() {\n" + " bool (*fp)() = f;\n" + " assert(fp == f);\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); } void memberFunctionCallInAssert() {