mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Properly generates an error when allocating in a const expression
This commit is contained in:
parent
3e763b41df
commit
d1334b0c8f
1 changed files with 1 additions and 18 deletions
|
@ -8242,24 +8242,7 @@ BfIRValue BfModule::AllocFromType(BfType* type, const BfAllocTarget& allocTarget
|
||||||
|
|
||||||
if ((!hasCustomAllocator) && (mBfIRBuilder->mIgnoreWrites))
|
if ((!hasCustomAllocator) && (mBfIRBuilder->mIgnoreWrites))
|
||||||
{
|
{
|
||||||
if (arraySize)
|
return mBfIRBuilder->GetFakeVal();
|
||||||
{
|
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AddDependency(type, mCurTypeInstance, BfDependencyMap::DependencyFlag_Allocates);
|
AddDependency(type, mCurTypeInstance, BfDependencyMap::DependencyFlag_Allocates);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue