[Issue 15702] std.socket.Socket.receive breaks @safe

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Feb 18 08:20:18 PST 2016


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

--- Comment #1 from hsteoh at quickfur.ath.cx ---
This problem is made much worse by
https://issues.dlang.org/show_bug.cgi?id=15672, because that allows the
following truly evil code:

------
void readData(void[] buffer) @safe
{
        ubyte[] buf = cast(ubyte[]) buffer; // why does this compile?!
        buf[0] = 0xFF;
}
void main() @safe
{
        auto buffer = new Object[1];
        readData(buffer);
}
------

Thus, the @safe annotations here guarantee nothing at all.

--


More information about the Digitalmars-d-bugs mailing list