--------
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?

Reply via email to