[Issue 14445] std.net.curl not usable in @safe code
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jun 14 20:20:04 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=14445
Nick Treleaven <nick at geany.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nick at geany.org
--- Comment #2 from Nick Treleaven <nick at geany.org> ---
Writing to a `void[]` cannot be @safe:
```d
string msg = "Hello world";
auto client = HTTP("dlang.org");
client.onSend = delegate size_t(void[] data)
{
auto m = cast(void[]) msg;
size_t length = m.length > data.length ? data.length : m.length;
if (length == 0) return 0;
data[0 .. length] = m[0 .. length];
msg = msg[length..$];
return length;
};
```
So that needs fixing in the API.
--
More information about the Digitalmars-d-bugs
mailing list