Added error instead of assertion failure when trying to get !TypeInfo for a forward declared struct.

This commit is contained in:
Tomas Lindquist Olsen
2009-05-11 20:54:25 +02:00
parent e4e07baf87
commit 77cb1c6b8e

View File

@@ -652,6 +652,14 @@ void TypeInfoStructDeclaration::llvmDefine()
assert(tinfo->ty == Tstruct);
TypeStruct *tc = (TypeStruct *)tinfo;
StructDeclaration *sd = tc->sym;
// can't emit typeinfo for forward declarations
if (sd->sizeok != 1)
{
sd->error("cannot emit TypeInfo for forward declaration");
fatal();
}
sd->codegen(Type::sir);
ClassDeclaration* base = Type::typeinfostruct;