Fix regression: functionStatic related to overload resolution (#3705)
This commit is contained in:
parent
12abf85d1d
commit
781a145680
|
@ -7094,8 +7094,9 @@ ValueType::MatchResult ValueType::matchParameter(const ValueType *call, const Va
|
||||||
{
|
{
|
||||||
ValueType vt;
|
ValueType vt;
|
||||||
const ValueType* pvt = funcVar->valueType();
|
const ValueType* pvt = funcVar->valueType();
|
||||||
if (pvt && funcVar->isArray()) {
|
if (pvt && funcVar->isArray() && !(funcVar->isStlType() && Token::simpleMatch(funcVar->typeStartToken(), "std :: array"))) { // std::array doesn't decay to a pointer
|
||||||
vt = *pvt;
|
vt = *pvt;
|
||||||
|
if (vt.pointer == 0) // don't bump array of pointers
|
||||||
++vt.pointer;
|
++vt.pointer;
|
||||||
pvt = &vt;
|
pvt = &vt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,6 +201,7 @@ private:
|
||||||
TEST_CASE(const_shared_ptr);
|
TEST_CASE(const_shared_ptr);
|
||||||
TEST_CASE(constPtrToConstPtr);
|
TEST_CASE(constPtrToConstPtr);
|
||||||
TEST_CASE(constTrailingReturnType);
|
TEST_CASE(constTrailingReturnType);
|
||||||
|
TEST_CASE(staticArrayPtrOverload);
|
||||||
|
|
||||||
TEST_CASE(initializerListOrder);
|
TEST_CASE(initializerListOrder);
|
||||||
TEST_CASE(initializerListUsage);
|
TEST_CASE(initializerListUsage);
|
||||||
|
@ -6569,6 +6570,23 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void staticArrayPtrOverload() {
|
||||||
|
checkConst("struct S {\n"
|
||||||
|
" template<size_t N>\n"
|
||||||
|
" void f(const std::array<std::string_view, N>& sv);\n"
|
||||||
|
" template<long N>\n"
|
||||||
|
" 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"
|
||||||
|
" const char* ptrs[N]{};\n"
|
||||||
|
" return f(ptrs);\n"
|
||||||
|
"}\n"
|
||||||
|
"template void S::f(const std::array<std::string_view, 3>&sv);\n"
|
||||||
|
"\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
#define checkInitializerListOrder(code) checkInitializerListOrder_(code, __FILE__, __LINE__)
|
#define checkInitializerListOrder(code) checkInitializerListOrder_(code, __FILE__, __LINE__)
|
||||||
void checkInitializerListOrder_(const char code[], const char* file, int line) {
|
void checkInitializerListOrder_(const char code[], const char* file, int line) {
|
||||||
// Clear the error log
|
// Clear the error log
|
||||||
|
|
Loading…
Reference in New Issue