https://issues.dlang.org/show_bug.cgi?id=20000
Issue ID: 20000
Summary: Casting to interfaces arbitrarily disallowed in @safe
code
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
```
interface A {}
class C1 {}
class C2 : A {}
bool isA(Object obj) @safe
{
if (auto a = cast(A) obj)
return true;
return false;
}
void main()
{
import std.stdio : writeln;
writeln(isA(new C1()));
writeln(isA(new C2()));
}
```
--