Casts from interface to class generally need to be dynamic. Fixes #189.

This commit is contained in:
Christian Kamm 2009-01-25 12:35:11 +01:00
parent 921a326865
commit f82ca73c76

View file

@ -1090,11 +1090,11 @@ DValue* DtoCastClass(DValue* val, Type* _to)
// interface -> class
if (fc->sym->isInterfaceDeclaration()) {
Logger::println("interface cast");
return DtoCastInterfaceToObject(val, _to);
return DtoDynamicCastInterface(val, _to);
}
// class -> class - static down cast
else if (tc->sym->isBaseOf(fc->sym,NULL)) {
Logger::println("static down cast)");
Logger::println("static down cast");
const LLType* tolltype = DtoType(_to);
LLValue* rval = DtoBitCast(val->getRVal(), tolltype);
return new DImValue(_to, rval);