Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7093,12 +7093,16 @@ ValueType::MatchResult ValueType::matchParameter(const ValueType *call, const Va
return ValueType::MatchResult::FALLBACK2;
return ValueType::MatchResult::NOMATCH; // TODO
}
if (call->pointer > 0 && ((call->constness | func->constness) != func->constness))
return ValueType::MatchResult::NOMATCH;
if (call->pointer > 0) {
if ((call->constness | func->constness) != func->constness)
return ValueType::MatchResult::NOMATCH;
if (call->constness == 0 && func->constness != 0 && func->reference != Reference::None)
return ValueType::MatchResult::NOMATCH;
}
if (call->type != func->type) {
if (call->type == ValueType::Type::VOID || func->type == ValueType::Type::VOID)
return ValueType::MatchResult::FALLBACK1;
if (call->pointer > 0 && func->pointer > 0)
if (call->pointer > 0)
return func->type == ValueType::UNKNOWN_TYPE ? ValueType::MatchResult::UNKNOWN : ValueType::MatchResult::NOMATCH;
if (call->isIntegral() && func->isIntegral())
return call->type < func->type ?
Expand Down
5 changes: 2 additions & 3 deletions test/testclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6725,12 +6725,11 @@ class TestClass : public TestFixture {
" void f(const char* const (&StrArr)[N]);\n"
"};\n"
"template<size_t N>\n"
"void S::f(const std::array<std::string_view, N>&sv) {\n"
"void S::f(const std::array<std::string_view, N>& sv) {\n"
" const char* ptrs[N]{};\n"
" return f(ptrs);\n"
"}\n"
"template void S::f(const std::array<std::string_view, 3>&sv);\n"
"\n");
"template void S::f(const std::array<std::string_view, 3>& sv);\n");
ASSERT_EQUALS("", errout.str());
}

Expand Down
10 changes: 10 additions & 0 deletions test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2654,6 +2654,16 @@ class TestOther : public TestFixture {
" void f(Foo& foo) const { int* q = foo.get(); *q = j; }\n"
"};\n");
ASSERT_EQUALS("", errout.str());

check("struct S {\n" // #10679
" void g(long L, const C*& PC) const;\n"
" void g(long L, C*& PC);\n"
"};\n"
"void f(S& s) {\n"
" C* PC{};\n"
" s.g(0, PC);\n"
"};\n");
ASSERT_EQUALS("", errout.str());
}

void constParameterCallback() {
Expand Down