mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Fixed for discriminated unions with attempted initializers
This commit is contained in:
parent
fd3265445d
commit
2192305800
1 changed files with 8 additions and 2 deletions
|
@ -3659,8 +3659,8 @@ void BfModule::ResolveConstField(BfTypeInstance* typeInstance, BfFieldInstance*
|
|||
Fail("Const requires initializer", fieldDef->mFieldDeclaration->mNameNode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else if (mBfIRBuilder != NULL)
|
||||
{
|
||||
SetAndRestoreValue<BfTypeInstance*> prevTypeInstance(mCurTypeInstance, typeInstance);
|
||||
|
||||
SetAndRestoreValue<bool> prevIgnoreWrite(mBfIRBuilder->mIgnoreWrites, true);
|
||||
|
@ -3692,6 +3692,12 @@ void BfModule::ResolveConstField(BfTypeInstance* typeInstance, BfFieldInstance*
|
|||
constValue = uncastedInitValue.mValue;
|
||||
}
|
||||
|
||||
if ((mCurTypeInstance->IsPayloadEnum()) && (fieldDef->IsEnumCaseEntry()))
|
||||
{
|
||||
// Illegal
|
||||
constValue = BfIRValue();
|
||||
}
|
||||
|
||||
mBfIRBuilder->SetInsertPoint(prevInsertBlock);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue