[Issue 2013] interface to interface dynamic cast is incorrect in some cases
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Jul 18 05:16:31 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=2013
Kenji Hara <k.hara.pg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|D1 (retired) |D2
Summary|Dynamic cast is incorrect |interface to interface
|in some cases |dynamic cast is incorrect
| |in some cases
--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> ---
Still happens in D2.
(In reply to David Friedman from comment #1)
> Created attachment 248 [details]
> Test Cast
Simplified the test case:
interface IA { int mA(); }
interface IB : IA { int mB(); }
interface IC : IB { }
interface ID : IA, IC { int mD(); }
class C : ID
{
int mA() { return 1; }
int mB() { return 2; }
int mD() { return 3; }
}
void main()
{
C c = new C;
IA ia = c;
IB ib = cast(IB)ia;
assert(ib.mB() == 2);
}
--
More information about the Digitalmars-d-bugs
mailing list