https://issues.dlang.org/show_bug.cgi?id=16056

--- Comment #2 from Eyal Lotem <eyal.lo...@gmail.com> ---
(In reply to ag0aep6g from comment #1)
> The struct doesn't really matter here, as far as I see. Simplified code:
> 
> ----
> import std.stdio;
> 
> pure void pure_func(immutable void delegate() pure f)
> {
>     f();
> }
> 
> void main() {
>     int y;
>     writeln("Before: ", y);
>     pure_func({ y++; });
>     writeln("After: ", y);
> }
> ----
> 
> Possibly a duplicate of issue 11043 or issue 1983.

This is simpler -- but this simpler example isn't a bug: a pure func that takes
a mutable delegate is "weakly pure" because it doesn't take an immutable
argument. You could say that the simplified pure func takes an explicitly
mutable argument, so it is known to be weakly pure.

When you do take an immutable argument in a pure function -- the immutability
is supposed to be transitive -- so it is supposed to be strongly pure.

--

Reply via email to