ValueType::matchParameter: Fix matching of char** and void*
This commit is contained in:
parent
549452b7b9
commit
1eb5f2266c
|
@ -5846,6 +5846,8 @@ ValueType::MatchResult ValueType::matchParameter(const ValueType *call, const Va
|
||||||
if (!call || !func)
|
if (!call || !func)
|
||||||
return ValueType::MatchResult::UNKNOWN;
|
return ValueType::MatchResult::UNKNOWN;
|
||||||
if (call->pointer != func->pointer) {
|
if (call->pointer != func->pointer) {
|
||||||
|
if (call->pointer > 1 && func->pointer == 1 && func->type == ValueType::Type::VOID)
|
||||||
|
return ValueType::MatchResult::FALLBACK1;
|
||||||
if (call->pointer < func->pointer && !call->isIntegral())
|
if (call->pointer < func->pointer && !call->isIntegral())
|
||||||
return ValueType::MatchResult::NOMATCH;
|
return ValueType::MatchResult::NOMATCH;
|
||||||
if (func->pointer < call->pointer && !func->isIntegral())
|
if (func->pointer < call->pointer && !func->isIntegral())
|
||||||
|
|
|
@ -5544,6 +5544,9 @@ private:
|
||||||
ValueType vt_int_pointer(ValueType::Sign::SIGNED, ValueType::Type::INT, 1); // not compatible
|
ValueType vt_int_pointer(ValueType::Sign::SIGNED, ValueType::Type::INT, 1); // not compatible
|
||||||
ASSERT_EQUALS((int)ValueType::MatchResult::FALLBACK1, (int)ValueType::matchParameter(&vt_char_pointer, &vt_void_pointer));
|
ASSERT_EQUALS((int)ValueType::MatchResult::FALLBACK1, (int)ValueType::matchParameter(&vt_char_pointer, &vt_void_pointer));
|
||||||
ASSERT_EQUALS((int)ValueType::MatchResult::NOMATCH, (int)ValueType::matchParameter(&vt_char_pointer, &vt_int_pointer));
|
ASSERT_EQUALS((int)ValueType::MatchResult::NOMATCH, (int)ValueType::matchParameter(&vt_char_pointer, &vt_int_pointer));
|
||||||
|
|
||||||
|
ValueType vt_char_pointer2(ValueType::Sign::SIGNED, ValueType::Type::CHAR, 2);
|
||||||
|
ASSERT_EQUALS((int)ValueType::MatchResult::FALLBACK1, (int)ValueType::matchParameter(&vt_char_pointer2, &vt_void_pointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FUNC(x) const Function *x = findFunctionByName(#x, &db->scopeList.front()); \
|
#define FUNC(x) const Function *x = findFunctionByName(#x, &db->scopeList.front()); \
|
||||||
|
|
Loading…
Reference in New Issue