I think the following behavior of DMD is not mirrored in the documentation. void main(){ int x; void foo()pure{x=2;} // error } I think the spec is right, making this an error is problematic: int bar(int delegate()pure dg)pure{return dg();} int foo(int x)pure{ return bar({return x+1;});// error } struct Delegate{ int function(int*)pure fun; int* context; int call()pure{return fun(context);} } int bar2(Delegate dg)pure{return dg.call();} int foo2(int x)pure{ return bar2(Delegate(function(int* ptr){return *ptr+1;}, &x)); // fine }
This is a dup of issue 9148, so it will be properly fixed in 2.067. *** This issue has been marked as a duplicate of issue 9148 ***