February 07, 2012 [Issue 7457] New: nested pure functions not specified | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7457 Summary: nested pure functions not specified Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: timon.gehr@gmx.ch --- Comment #0 from timon.gehr@gmx.ch 2012-02-07 10:53:41 PST --- 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 } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation