diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 016602d26..4902bf482 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -3977,7 +3977,7 @@ const Function* Scope::findFunction(const Token *tok, bool requireConst) const } // Try to evaluate the apparently more complex expression - else if (!funcarg->isArrayOrPointer()) { // TODO: Pointers + else { const Token* argtok = arguments[j]; while (argtok->astParent() && argtok->astParent() != tok->next() && argtok->astParent()->str() != ",") { argtok = argtok->astParent(); diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 101536255..4a536b565 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -3682,16 +3682,18 @@ private: } void findFunction16() { - GET_SYMBOL_DB("struct C { int i; static int si; float f; };\n" + GET_SYMBOL_DB("struct C { int i; static int si; float f; int* ip; float* fp};\n" "void foo(float a) { }\n" "void foo(int a) { }\n" - "void foo(bool a) { }\n" + "void foo(int* a) { }\n" "void func(C c, C* cp) {\n" " foo(c.i);\n" " foo(cp->i);\n" " foo(c.f);\n" " foo(c.si);\n" " foo(C::si);\n" + " foo(c.ip);\n" + " foo(c.fp);\n" "}"); ASSERT_EQUALS("", errout.str()); @@ -3710,6 +3712,12 @@ private: f = Token::findsimplematch(tokenizer.tokens(), "foo ( C :: si ) ;"); ASSERT_EQUALS(true, f && f->function() && f->function()->tokenDef->linenr() == 3); + + f = Token::findsimplematch(tokenizer.tokens(), "foo ( c . ip ) ;"); + ASSERT_EQUALS(true, f && f->function() && f->function()->tokenDef->linenr() == 4); + + f = Token::findsimplematch(tokenizer.tokens(), "foo ( c . fp ) ;"); + ASSERT_EQUALS(true, f && f->function() == nullptr); }