mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 09:00:33 +03:00
Casts from interface to class generally need to be dynamic. Fixes #189.
This commit is contained in:
parent
921a326865
commit
f82ca73c76
1 changed files with 2 additions and 2 deletions
|
@ -1090,11 +1090,11 @@ DValue* DtoCastClass(DValue* val, Type* _to)
|
||||||
// interface -> class
|
// interface -> class
|
||||||
if (fc->sym->isInterfaceDeclaration()) {
|
if (fc->sym->isInterfaceDeclaration()) {
|
||||||
Logger::println("interface cast");
|
Logger::println("interface cast");
|
||||||
return DtoCastInterfaceToObject(val, _to);
|
return DtoDynamicCastInterface(val, _to);
|
||||||
}
|
}
|
||||||
// class -> class - static down cast
|
// class -> class - static down cast
|
||||||
else if (tc->sym->isBaseOf(fc->sym,NULL)) {
|
else if (tc->sym->isBaseOf(fc->sym,NULL)) {
|
||||||
Logger::println("static down cast)");
|
Logger::println("static down cast");
|
||||||
const LLType* tolltype = DtoType(_to);
|
const LLType* tolltype = DtoType(_to);
|
||||||
LLValue* rval = DtoBitCast(val->getRVal(), tolltype);
|
LLValue* rval = DtoBitCast(val->getRVal(), tolltype);
|
||||||
return new DImValue(_to, rval);
|
return new DImValue(_to, rval);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue