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

--- Comment #2 from Eyal <[email protected]> ---
Better bug reproduction:

@safe:

void f(ref int counter, lazy int x) pure {
    x();
    counter++;
    x();
}

void main() {
    int counter;
    int g() {
        import std.stdio:writeln;
        writeln("counter: ", counter);
        return 5;
    }
    f(counter, g);
}

// prints:
counter: 0
counter: 1

Making it clearer that we're being allowed to pass an impure delegate into a
pure function that then calls it.

--

Reply via email to