[Issue 20000] Casting to interfaces arbitrarily disallowed in @safe code
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jun 23 21:55:24 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20000
Basile-z <b2.temp at gmx.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |b2.temp at gmx.com
--- Comment #1 from Basile-z <b2.temp at gmx.com> ---
This is more subtle:
---
module runnable;
import std.stdio;
extern(C++) interface Foo
{
void foo();
}
extern(C++) interface Bar
{
void bar();
}
extern(C++) class C1 : Foo
{
void foo(){writeln("do I look like a Bar !!");}
}
void main(string[] args)
{
(cast(Bar) new C1).bar();
}
---
With the C++ compat this is clearly not @safe. The fix would have to check
carefully these details.
--
More information about the Digitalmars-d-bugs
mailing list