diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 3875a44b5..f4c34b60d 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -6105,6 +6105,8 @@ ValueType::MatchResult ValueType::matchParameter(const ValueType *call, const Va if (call->pointer != func->pointer) { if (call->pointer > 1 && func->pointer == 1 && func->type == ValueType::Type::VOID) return ValueType::MatchResult::FALLBACK1; + if (call->pointer == 1 && func->pointer == 0 && func->isIntegral() && func->sign != ValueType::Sign::SIGNED) + return ValueType::MatchResult::FALLBACK1; if (call->pointer == 1 && call->type == ValueType::Type::CHAR && func->pointer == 0 && func->container && func->container->stdStringLike) return ValueType::MatchResult::FALLBACK2; return ValueType::MatchResult::NOMATCH; // TODO diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 5c92c49fa..324e593f3 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -357,6 +357,7 @@ private: TEST_CASE(findFunction28); TEST_CASE(findFunction29); TEST_CASE(findFunction30); + TEST_CASE(findFunction31); TEST_CASE(findFunctionContainer); TEST_CASE(findFunctionExternC); TEST_CASE(findFunctionGlobalScope); // ::foo @@ -5375,7 +5376,7 @@ private: ASSERT_EQUALS(true, f && f->function() && f->function()->tokenDef->linenr() == 3); f = Token::findsimplematch(tokenizer.tokens(), "foo ( ccp ) ;"); - ASSERT_EQUALS(true, f && f->function() == nullptr); + ASSERT_EQUALS(true, f && f->function() && f->function()->tokenDef->linenr() == 5); f = Token::findsimplematch(tokenizer.tokens(), "foo ( f ) ;"); ASSERT_EQUALS(true, f && f->function() && f->function()->tokenDef->linenr() == 4); @@ -5822,6 +5823,17 @@ private: ASSERT(!bar->function()); } + void findFunction31() { + GET_SYMBOL_DB("void foo(bool);\n" + "void foo(std::string s);\n" + "void bar() { foo(\"123\"); }"); + const Token *foo = Token::findsimplematch(tokenizer.tokens(), "foo ( \"123\" ) ;"); + ASSERT(foo); + ASSERT(foo->function()); + ASSERT(foo->function()->tokenDef); + ASSERT_EQUALS(1, foo->function()->tokenDef->linenr()); + } + void findFunctionContainer() { { GET_SYMBOL_DB("void dostuff(std::vector v);\n"