September 19
https://issues.dlang.org/show_bug.cgi?id=24772

          Issue ID: 24772
           Summary: Casting class references to void* should be @safe
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: safe
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: ogion.art@gmail.com

Any pointer implicitly converts to void*. This is considered safe. Class references are essentially pointers, but converting them to void* requires implicit cast. This makes this conversion illegal in safe code, even though it doesn’t violate memory safety.

class C {}
interface I {}

C c;
I i;

@safe void main()
{
    auto cp = cast(void*)c; // Error: cast from `app.C` to `void*` not allowed
in safe code
    auto ip = cast(void*)i; // Error: cast from `app.I` to `void*` not allowed
in safe code
}

--