Is @safe still a work-in-progress?
Peter Alexander
peter.alexander.au at gmail.com
Fri Aug 17 07:19:25 UTC 2018
--------
import std.algorithm, std.stdio;
@safe:
auto foo() {
int[6] xs = [0, 1, 2, 3, 4, 5];
return xs[].map!(x => x);
}
void main() {
writeln(foo());
}
--------
https://run.dlang.io/is/qC7HUR
For me this gives:
--------
[0, 0, -2132056872, 22008, 0, 0]
--------
Which looks like its just reading arbitrary memory.
I've filed https://issues.dlang.org/show_bug.cgi?id=19175
My question is: what is the status of @safe? I am quite surprised
to see such a simple case fail. Is @safe believed to be fully
implemented (modulo bugs) and this is just an unfortunate corner
case, or is it known work-in-progress?
More information about the Digitalmars-d
mailing list