Re: assumeNoGC works but can't get an assumePure to work

2018-09-04 Thread aliak via Digitalmars-d-learn
On Tuesday, 4 September 2018 at 01:33:52 UTC, Paul Backus wrote: On Monday, 3 September 2018 at 22:07:10 UTC, aliak wrote: Why does it work with nogc but not with pure? Cheers, - Ali You can't define an impure function inside a pure unittest. If you move `modify` outside the unittest block,

Re: assumeNoGC works but can't get an assumePure to work

2018-09-03 Thread Paul Backus via Digitalmars-d-learn
On Monday, 3 September 2018 at 22:07:10 UTC, aliak wrote: Why does it work with nogc but not with pure? Cheers, - Ali You can't define an impure function inside a pure unittest. If you move `modify` outside the unittest block, and change the argument from a lambda to a function pointer, it

assumeNoGC works but can't get an assumePure to work

2018-09-03 Thread aliak via Digitalmars-d-learn
In another thread [0] this function can be used to call non nogc code from nogc code import std.traits; auto assumeNoGC(T)(T t) { enum attrs = functionAttributes!T | FunctionAttribute.nogc; return cast(SetFunctionAttributes!(T, functionLinkage!T, attrs)) t; } And then you can use it