parent
2cacb13f85
commit
511520d623
|
@ -7098,12 +7098,16 @@ ValueType::MatchResult ValueType::matchParameter(const ValueType *call, const Va
|
||||||
return ValueType::MatchResult::FALLBACK2;
|
return ValueType::MatchResult::FALLBACK2;
|
||||||
return ValueType::MatchResult::NOMATCH; // TODO
|
return ValueType::MatchResult::NOMATCH; // TODO
|
||||||
}
|
}
|
||||||
if (call->pointer > 0 && ((call->constness | func->constness) != func->constness))
|
if (call->pointer > 0) {
|
||||||
return ValueType::MatchResult::NOMATCH;
|
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 != func->type) {
|
||||||
if (call->type == ValueType::Type::VOID || func->type == ValueType::Type::VOID)
|
if (call->type == ValueType::Type::VOID || func->type == ValueType::Type::VOID)
|
||||||
return ValueType::MatchResult::FALLBACK1;
|
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;
|
return func->type == ValueType::UNKNOWN_TYPE ? ValueType::MatchResult::UNKNOWN : ValueType::MatchResult::NOMATCH;
|
||||||
if (call->isIntegral() && func->isIntegral())
|
if (call->isIntegral() && func->isIntegral())
|
||||||
return call->type < func->type ?
|
return call->type < func->type ?
|
||||||
|
|
|
@ -6744,12 +6744,11 @@ private:
|
||||||
" void f(const char* const (&StrArr)[N]);\n"
|
" void f(const char* const (&StrArr)[N]);\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"template<size_t 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"
|
" const char* ptrs[N]{};\n"
|
||||||
" return f(ptrs);\n"
|
" return f(ptrs);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"template void S::f(const std::array<std::string_view, 3>&sv);\n"
|
"template void S::f(const std::array<std::string_view, 3>& sv);\n");
|
||||||
"\n");
|
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2666,6 +2666,16 @@ private:
|
||||||
" void f(Foo& foo) const { int* q = foo.get(); *q = j; }\n"
|
" void f(Foo& foo) const { int* q = foo.get(); *q = j; }\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
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() {
|
void constParameterCallback() {
|
||||||
|
|
Loading…
Reference in New Issue