diff --git a/gen/typinf.cpp b/gen/typinf.cpp index a9a8b4b4..1cebe274 100644 --- a/gen/typinf.cpp +++ b/gen/typinf.cpp @@ -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;