diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index d2d50a7db..e499744c9 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -3836,10 +3836,7 @@ const Function* Scope::findFunction(const Token *tok, bool requireConst) const same++; } } else { - if (funcarg->typeStartToken()->str() == "int" && - !funcarg->typeStartToken()->isUnsigned()) { - same++; - } else if (Token::Match(funcarg->typeStartToken(), "char|short|int")) { + if (Token::Match(funcarg->typeStartToken(), "char|short|int|long")) { same++; } } diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index dc3d9446b..f617543a7 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -280,6 +280,7 @@ private: TEST_CASE(findFunction9); TEST_CASE(findFunction10); // #7673 TEST_CASE(findFunction11); + TEST_CASE(findFunction12); TEST_CASE(noexceptFunction1); TEST_CASE(noexceptFunction2); @@ -3489,6 +3490,19 @@ private: ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 4); } + void findFunction12() { + GET_SYMBOL_DB("void foo(std::string a) { }\n" + "void foo(long long a) { }\n" + "void foo() {\n" + " foo(0);\n" + "}"); + + ASSERT_EQUALS("", errout.str()); + + const Token *f = Token::findsimplematch(tokenizer.tokens(), "foo ( 0 ) ;"); + ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 2); + } + #define FUNC(x) const Function *x = findFunctionByName(#x, &db->scopeList.front()); \ ASSERT_EQUALS(true, x != nullptr); \ if (x) ASSERT_EQUALS(true, x->isNoExcept());