Fix ValueType::matchParameter for 'const float *' => 'signed long long'

This commit is contained in:
Daniel Marjamäki 2019-07-31 18:55:55 +02:00
parent 91ca6165eb
commit 8deb855b41
2 changed files with 5 additions and 5 deletions

View File

@ -5807,11 +5807,7 @@ ValueType::MatchResult ValueType::matchParameter(const ValueType *call, const Va
if (call->pointer != func->pointer) { if (call->pointer != func->pointer) {
if (call->pointer > 1 && func->pointer == 1 && func->type == ValueType::Type::VOID) if (call->pointer > 1 && func->pointer == 1 && func->type == ValueType::Type::VOID)
return ValueType::MatchResult::FALLBACK1; return ValueType::MatchResult::FALLBACK1;
if (call->pointer < func->pointer && !call->isIntegral()) return ValueType::MatchResult::NOMATCH; // TODO
return ValueType::MatchResult::NOMATCH;
if (func->pointer < call->pointer && !func->isIntegral())
return ValueType::MatchResult::NOMATCH;
return ValueType::MatchResult::UNKNOWN; // TODO
} }
if (call->pointer > 0 && ((call->constness | func->constness) != func->constness)) if (call->pointer > 0 && ((call->constness | func->constness) != func->constness))
return ValueType::MatchResult::NOMATCH; return ValueType::MatchResult::NOMATCH;

View File

@ -5547,6 +5547,10 @@ private:
ValueType vt_char_pointer2(ValueType::Sign::SIGNED, ValueType::Type::CHAR, 2); 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)); ASSERT_EQUALS((int)ValueType::MatchResult::FALLBACK1, (int)ValueType::matchParameter(&vt_char_pointer2, &vt_void_pointer));
ValueType vt_const_float_pointer(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::FLOAT, 1, 1);
ValueType vt_long_long(ValueType::Sign::SIGNED, ValueType::Type::LONGLONG, 0, 0);
ASSERT_EQUALS((int)ValueType::MatchResult::NOMATCH, (int)ValueType::matchParameter(&vt_const_float_pointer, &vt_long_long));
} }
#define FUNC(x) const Function *x = findFunctionByName(#x, &db->scopeList.front()); \ #define FUNC(x) const Function *x = findFunctionByName(#x, &db->scopeList.front()); \