1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Properly generates an error when allocating in a const expression

This commit is contained in:
Brian Fiete 2020-11-18 10:13:46 -08:00
parent 3e763b41df
commit d1334b0c8f

View file

@ -8242,24 +8242,7 @@ BfIRValue BfModule::AllocFromType(BfType* type, const BfAllocTarget& allocTarget
if ((!hasCustomAllocator) && (mBfIRBuilder->mIgnoreWrites))
{
if (arraySize)
{
if (isRawArrayAlloc)
{
BfPointerType* ptrType = CreatePointerType(type);
return GetDefaultValue(ptrType);
}
BfArrayType* arrayType = CreateArrayType(type, arrayDim);
return GetDefaultValue(arrayType);
}
if (type->IsValueType())
{
BfPointerType* ptrType = CreatePointerType(type);
return GetDefaultValue(ptrType);
}
return mBfIRBuilder->CreateAlloca(mBfIRBuilder->MapType(type));
return mBfIRBuilder->GetFakeVal();
}
AddDependency(type, mCurTypeInstance, BfDependencyMap::DependencyFlag_Allocates);