comparison gen/typinf.cpp @ 1345:712662f45ee4

Added error instead of assertion failure when trying to get !TypeInfo for a forward declared struct.
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Mon, 11 May 2009 20:54:25 +0200
parents 3297edb697eb
children 78038e540342
comparison
equal deleted inserted replaced
1344:3297edb697eb 1345:712662f45ee4
650 650
651 // make sure struct is resolved 651 // make sure struct is resolved
652 assert(tinfo->ty == Tstruct); 652 assert(tinfo->ty == Tstruct);
653 TypeStruct *tc = (TypeStruct *)tinfo; 653 TypeStruct *tc = (TypeStruct *)tinfo;
654 StructDeclaration *sd = tc->sym; 654 StructDeclaration *sd = tc->sym;
655
656 // can't emit typeinfo for forward declarations
657 if (sd->sizeok != 1)
658 {
659 sd->error("cannot emit TypeInfo for forward declaration");
660 fatal();
661 }
662
655 sd->codegen(Type::sir); 663 sd->codegen(Type::sir);
656 664
657 ClassDeclaration* base = Type::typeinfostruct; 665 ClassDeclaration* base = Type::typeinfostruct;
658 base->codegen(Type::sir); 666 base->codegen(Type::sir);
659 667