On Tuesday, 26 December 2017 at 00:17:33 UTC, Mike Franklin wrote:
After a few hours trying to figure out why the compiler didn't
catch this, I finally figured it out. You have to add `@safe`.
import std.stdio;
int[] x;
void func(scope int[] a) @safe
{
x = a;
}
void main() @safe {
func([0,1,2]);
writeln(x);
}
This is one of the things really ticks me off about D; it has
all the wrong defaults.
At a minimum, the documentation needs clarification. I
encourage you to file a bug report against the documentation
at http://issues.dlang.org/
Mike
Oh! Surely adding @safe makes the expected behavior.
According to your advice, I try to post a bug report.
Thanks!
Sobaya