Fixed forward referenced structs.

This commit is contained in:
Tomas Lindquist Olsen
2009-04-16 20:41:27 +02:00
parent 1437bd6b7e
commit 414e58a318
2 changed files with 8 additions and 0 deletions

View File

@@ -36,6 +36,10 @@ void DtoResolveStruct(StructDeclaration* sd)
// make sure type exists
DtoType(sd->type);
// if it's a forward declaration, all bets are off. The type should be enough
if (sd->sizeok != 1)
return;
// create the IrStruct
IrStruct* irstruct = new IrStruct(sd);
sd->ir.irStruct = irstruct;

View File

@@ -67,6 +67,10 @@ const llvm::Type* IrTypeStruct::buildType()
IF_LOG Logger::println("Building struct type %s @ %s", sd->toPrettyChars(), sd->locToChars());
LOG_SCOPE;
// if it's a forward declaration, all bets are off, stick with the opaque
if (sd->sizeok != 1)
return pa.get();
// find the fields that contribute to the default initializer.
// these will define the default type.