[Issue 24772] Casting class references to void* should be @safe

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 19 16:27:11 UTC 2024


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

--- Comment #2 from Georgy Markov <ogion.art at gmail.com> ---
(In reply to Richard (Rikki) Andrew Cattermole from comment #1)
> The only thing you can do once you cast it is cause program corruption.

interface MyCOMInterface : IUnknown 
{
    /*...*/
}

MyCOMInterface comObject;
CoCreateInstance(
    &clsid, 
    null, 
    CLSCTX_INPROC_SERVER,
    &iid, 
    &cast(void*)comObject,
);

--


More information about the Digitalmars-d-bugs mailing list