Skip to content

Instantly share code, notes, and snippets.

Created October 5, 2013 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/6847299 to your computer and use it in GitHub Desktop.
Save anonymous/6847299 to your computer and use it in GitHub Desktop.
testcase.d
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();
}
@FeepingCreature
Copy link

Agh, of course meant to say "not be different".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment