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

ag0ae...@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
                 CC|                            |ag0ae...@gmail.com
          Component|dlang.org                   |dmd
            Summary|[The D Bug Tracker]         |immutable delegate can
                   |                            |mutate through context
                   |                            |pointer
           Severity|enhancement                 |normal

--- Comment #1 from ag0ae...@gmail.com ---
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.

--

Reply via email to