[Issue 11178] Class may implement same interface multiple times with different interface pointers, breaking (a is b) semantics

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 17 07:55:45 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11178


Iain Buclaw <ibuclaw at ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw at ubuntu.com


--- Comment #1 from Iain Buclaw <ibuclaw at ubuntu.com> 2013-11-17 07:55:43 PST ---
Pasting in test case in comments just incase gist.github removes the pastebin.
=)


module testcase;

import std.stdio;

interface I1 { }
interface I2 : I1 { }

class C1 : I2 {
void foo() {
writefln("These should REALLY not be the same:");
writefln(": %s", cast(void*) cast(I2) cast(I1) this);
writefln(": %s", cast(void*) cast(I2) this);
writefln("for comparison");
Object obj = cast(Object) this;
writefln(": %s", cast(void*) cast(I2) cast(I1) obj);
writefln(": %s", cast(void*) cast(I2) obj);
}
}
class C2 : C1, I2 { }

void main() {
(new C2).foo();
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list