https://issues.dlang.org/show_bug.cgi?id=12664
Issue ID: 12664 Summary: @nogc for lazy arguments too Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P1 Component: DMD Assignee: nob...@puremagic.com Reporter: bearophile_h...@eml.cc (Issue understood with a little help from Dicebot.) This compiles: void foo(int delegate() @nogc x) @nogc { auto r = x(); } void main() { foo(() => 1); } This too compiles, performing inference: void foo(Deleg)(Deleg x) @nogc { auto r = x(); } void main() { foo(() => 1); } But this code: void foo(lazy int x) @nogc { auto r = x(); // Error } void main() { foo(1); } Gives with DMD 2.066alpha: test.d(2,15): Error: @nogc function 'test.foo' cannot call non-@nogc delegate 'x' I think the third program should compile. --