mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-12 10:53:14 +01:00
Casts from interface to class generally need to be dynamic. Fixes #189.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user