diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index d8f7d16fbaf..7c13306e8fd 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -2353,6 +2353,8 @@ bool CheckClass::isMemberVar(const Scope *scope, const Token *tok) const bool CheckClass::isMemberFunc(const Scope *scope, const Token *tok) { if (!tok->function()) { + if (Token::simpleMatch(tok->astParent(), ".") && Token::simpleMatch(tok->astParent()->astOperand1(), "this")) + return true; for (const Function &func : scope->functionList) { if (func.name() == tok->str()) { const Token* tok2 = tok->tokAt(2); diff --git a/test/testclass.cpp b/test/testclass.cpp index ffcf5b0f868..04f298774d1 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -6827,6 +6827,11 @@ class TestClass : public TestFixture { 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()); + + checkConst("struct S : U {\n" // #14425 + " void f() { this->g(); }\n" + "};\n"); + ASSERT_EQUALS("", errout_str()); } void const97() { // #13301