mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Disallowed cast from func constraint to void* or delegate to object
This commit is contained in:
parent
7b58863563
commit
bb6c59e39e
1 changed files with 25 additions and 17 deletions
|
@ -11513,6 +11513,13 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
|
|||
{
|
||||
SetAndRestoreValue<bool> prevIgnoreWrites(mBfIRBuilder->mIgnoreWrites, true);
|
||||
auto constraintTypeInst = genericParamInst->mTypeConstraint->ToTypeInstance();
|
||||
|
||||
if ((constraintTypeInst != NULL) && (constraintTypeInst->IsDelegateOrFunction()))
|
||||
{
|
||||
// Could be a methodref - can't cast to anything else
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((constraintTypeInst != NULL) && (constraintTypeInst->IsInstanceOf(mCompiler->mEnumTypeDef)) && (explicitCast))
|
||||
{
|
||||
// Enum->int
|
||||
|
@ -11538,6 +11545,7 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
|
|||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Generic constrained with class or pointer type -> void*
|
||||
if (toType->IsVoidPtr())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue