Thread overview
[Issue 20000] Casting to interfaces disallowed in @safe code
[Issue 20000] Casting to interfaces arbitrarily disallowed in @safe code
Jun 23, 2019
Basile-z
Jun 23, 2019
Dlang Bot
Jun 23, 2019
Nathan S.
Jun 24, 2019
anonymous4
Jun 25, 2019
Dlang Bot
Mar 21, 2020
Basile-z
June 23, 2019
https://issues.dlang.org/show_bug.cgi?id=20000

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com

--- Comment #1 from Basile-z <b2.temp@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.

--
June 23, 2019
https://issues.dlang.org/show_bug.cgi?id=20000

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@n8sh created dlang/dmd pull request #10080 "Issue 20000 - Casting to interfaces arbitrarily disallowed in @safe code" mentioning this issue:

- Issue 20000 - Casting to interfaces arbitrarily disallowed in @safe code

https://github.com/dlang/dmd/pull/10080

--
June 23, 2019
https://issues.dlang.org/show_bug.cgi?id=20000

Nathan S. <n8sh.secondary@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Casting to interfaces       |Casting to interfaces
                   |arbitrarily disallowed in   |disallowed in @safe code
                   |@safe code                  |

--
June 24, 2019
https://issues.dlang.org/show_bug.cgi?id=20000

anonymous4 <dfj1esp02@sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |safe, spec
           Severity|normal                      |enhancement

--- Comment #3 from anonymous4 <dfj1esp02@sneakemail.com> ---
Yeah, should work only for proper D interfaces.

--
June 25, 2019
https://issues.dlang.org/show_bug.cgi?id=20000

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #10080 "Issue 20000 - Casting to interfaces disallowed in @safe code" was merged into master:

- c062cdd2b35a4f40f352ea65194994188a5f9ed8 by Nathan Sashihara:
  Fix Issue 20000 - Casting to interfaces arbitrarily disallowed in @safe code

https://github.com/dlang/dmd/pull/10080

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=20000

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--