diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index f0780129..ed860901 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -3659,8 +3659,8 @@ void BfModule::ResolveConstField(BfTypeInstance* typeInstance, BfFieldInstance* Fail("Const requires initializer", fieldDef->mFieldDeclaration->mNameNode); } } - else - { + else if (mBfIRBuilder != NULL) + { SetAndRestoreValue prevTypeInstance(mCurTypeInstance, typeInstance); SetAndRestoreValue 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); }