1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Allow implicit cast from function to void*

This commit is contained in:
Brian Fiete 2020-09-11 23:17:55 -07:00
parent 8d934192c0
commit 4ecd7861d6

View file

@ -9560,14 +9560,14 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
return mBfIRBuilder->CreateBitCast(typedVal.mValue, mBfIRBuilder->MapType(toType));
}
if (explicitCast)
// Func -> void*
if ((typedVal.mType->IsFunction()) && (toType->IsVoidPtr()))
{
// Func -> void*
if ((typedVal.mType->IsFunction()) && (toType->IsVoidPtr()))
{
return mBfIRBuilder->CreateIntToPtr(typedVal.mValue, mBfIRBuilder->MapType(toType));
}
return mBfIRBuilder->CreateIntToPtr(typedVal.mValue, mBfIRBuilder->MapType(toType));
}
if (explicitCast)
{
// void* -> Func
if ((typedVal.mType->IsVoidPtr()) && (toType->IsFunction()))
{