May 26, 2014 One case of GC-allocated closure | ||||
---|---|---|---|---|
| ||||
I don't know if this is a bug, an enhancement request, or just a mistake of mine. I don't understand why currently @nogc refuses this code: import std.algorithm: filter; struct Foo { bool bar(in int) @nogc { return true; } auto spam() @nogc { immutable static data = [1, 2]; //return data.filter!bar; // Not allowed? return data.filter!(i => bar(i)); // Error } } void main() {} dmd 2.066alpha gives: test.d(6,10): Error: function test1.Foo.spam @nogc function allocates a closure with the GC Is this a bug/ER worth reporting? Bye, bearophile |
Copyright © 1999-2021 by the D Language Foundation