From 7aeed522a39041172233b36e01c9e070f50249f7 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 13 Jan 2026 15:16:56 +0100 Subject: [PATCH 1/2] Update checkclass.cpp --- lib/checkclass.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 11951411f8f..d8f7d16fbaf 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -2287,6 +2287,9 @@ bool CheckClass::isMemberVar(const Scope *scope, const Token *tok) const } else if (tok->str() == "]") { tok = tok->link()->previous(); again = true; + } else if (Token::Match(tok, "%name% ::")) { + tok = tok->tokAt(2); + again = true; } } while (again); From 12f64283dc33d7745ed50343e07ad4fb5e1c3e1b Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 13 Jan 2026 15:19:35 +0100 Subject: [PATCH 2/2] Update testclass.cpp --- test/testclass.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/testclass.cpp b/test/testclass.cpp index 46c61d41c37..ffcf5b0f868 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -6816,6 +6816,17 @@ class TestClass : public TestFixture { ASSERT_EQUALS("[test.cpp:4:7]: (style) Either there is a missing 'override', or the member function 'S::g' can be static. [functionStatic]\n" "[test.cpp:7:9]: (style) Either there is a missing 'override', or the member function 'S::h' can be static. [functionStatic]\n", errout_str()); + + checkConst("namespace N {\n" // #14391 + " void f();\n" + "}\n" + "struct S : U {\n" + " void g() { N::f(); }\n" + " void h() { ::N::f(); }\n" + "};\n"); + ASSERT_EQUALS("[test.cpp:5:10]: (style) Either there is a missing 'override', or the member function 'S::g' can be static. [functionStatic]\n" + "[test.cpp:6:10]: (style) Either there is a missing 'override', or the member function 'S::h' can be static. [functionStatic]\n", + errout_str()); } void const97() { // #13301