mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fix for sized array initializer with global variables
This commit is contained in:
parent
cd09529c9a
commit
3509d659ea
2 changed files with 10 additions and 2 deletions
|
@ -720,7 +720,14 @@ void BeIRCodeGen::Read(BeValue*& beValue)
|
|||
auto constStruct = mBeModule->mOwnedValues.Alloc<BeStructConstant>();
|
||||
constStruct->mType = type;
|
||||
for (auto val : values)
|
||||
constStruct->mMemberValues.push_back(BeValueDynCast<BeConstant>(val));
|
||||
{
|
||||
BeConstant* constant = BeValueDynCast<BeConstant>(val);
|
||||
constStruct->mMemberValues.push_back(constant);
|
||||
#ifdef _DEBUG
|
||||
auto memberType = constant->GetType();
|
||||
BF_ASSERT(memberType == arrayType->mElementType);
|
||||
#endif
|
||||
}
|
||||
beValue = constStruct;
|
||||
BE_MEM_END("ParamType_Const_Array");
|
||||
return;
|
||||
|
|
|
@ -15590,9 +15590,10 @@ void BfExprEvaluator::InitializedSizedArray(BfSizedArrayType* arrayType, BfToken
|
|||
// For now, we can't properly create const-valued non-size-aligned composites
|
||||
if (checkArrayType->mElementType->NeedsExplicitAlignment())
|
||||
isAllConst = false;
|
||||
|
||||
if (!elementValue.mValue.IsConst())
|
||||
isAllConst = false;
|
||||
if (elementValue.IsAddr())
|
||||
isAllConst = false;
|
||||
|
||||
InitValue initValue;
|
||||
initValue.mValue = elementValue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue