[Issue 17486] lazy parameters cannot be used in nothrow/@nogc functions
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jun 9 12:44:40 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17486
--- Comment #2 from Eyal <eyal at weka.io> ---
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.
--
More information about the Digitalmars-d-bugs
mailing list