diff --git a/IDEHelper/Compiler/BfIRBuilder.cpp b/IDEHelper/Compiler/BfIRBuilder.cpp index 8e1ace33..95307c23 100644 --- a/IDEHelper/Compiler/BfIRBuilder.cpp +++ b/IDEHelper/Compiler/BfIRBuilder.cpp @@ -866,6 +866,7 @@ BfIRValue BfIRConstHolder::CreateConstBitCast(BfIRValue val, BfIRType type) bitCast->mConstType = BfConstType_BitCastNull; else bitCast->mConstType = BfConstType_BitCast; + BF_ASSERT(val.mId != -1); bitCast->mTarget = val.mId; bitCast->mToType = type; diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index ba13dae6..1454d2ec 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -10880,6 +10880,8 @@ void BfModule::CurrentAddToConstHolder(BfIRValue& irVal) newVal = BfIRValue(BfIRValueFlags_Const, bitcast->mTarget); CurrentAddToConstHolder(newVal); } + else + newVal = mCurTypeInstance->GetOrCreateConstHolder()->CreateConstNull(); irVal = mCurTypeInstance->GetOrCreateConstHolder()->CreateConstBitCast(newVal, bitcast->mToType); return; }