1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Fixes to "valueless" crepr structs

This commit is contained in:
Brian Fiete 2025-03-28 09:33:06 -04:00
parent eb41a9c1de
commit 5c11c2271e
4 changed files with 29 additions and 5 deletions

View file

@ -3784,7 +3784,14 @@ void BfIRBuilder::CreateTypeDefinition_Data(BfModule* populateModule, BfTypeInst
SizedArray<BfIRType, 256> irFieldTypes;
if ((!typeInstance->IsTypedPrimitive()) && (typeInstance->mBaseType != NULL))
{
irFieldTypes.push_back(MapTypeInst(typeInstance->mBaseType, BfIRPopulateType_Eventually_Full));
if (typeInstance->mBaseType->IsValuelessCReprType())
{
// Fake an empty type to avoid having a one-byte base type
auto valueTypeType = mModule->ResolveTypeDef(mModule->mCompiler->mValueTypeTypeDef);
irFieldTypes.push_back(MapType(valueTypeType, BfIRPopulateType_Eventually_Full));
}
else
irFieldTypes.push_back(MapTypeInst(typeInstance->mBaseType, BfIRPopulateType_Eventually_Full));
}
SizedArray<BfIRMDNode, 256> diFieldTypes;