On 29.06.20 02:28, Stanislav Blinov wrote:
void local(Args...)(Args args)
void main() @safe
scope int* p;
local(p); // Ok
writeln(p); // Error: scope variable p assigned to non-scope
parameter _param_0 calling std.stdio.writeln!(int*).writeln
The signatures of `std.stdio.writeln` and `local` are the same (see
`writeln` ). Yet, with '$ dmd -preview=dip1000' the call to `local`
compiles, while the call to `writeln` doesn't.
Since `local` and `writeln` are templates, the attributes for their
parameters are inferred from their bodies. `local!(int*)` doesn't do
anything with the parameter, so it's inferred as `scope`.
`writeln!(int*)` apparently does something that prevents `scope` from