Re: Remove closure allocation

2018-05-27 Thread Malte via Digitalmars-d-learn
On Saturday, 26 May 2018 at 18:10:30 UTC, Neia Neutuladh wrote: On Saturday, 26 May 2018 at 15:00:40 UTC, Malte wrote: This compiles with DMD, however it returns random numbers instead of the value I passed in. Looks like a bug to me. Should that work or is there any other pattern I could use

Re: Remove closure allocation

2018-05-26 Thread Neia Neutuladh via Digitalmars-d-learn
On Saturday, 26 May 2018 at 15:00:40 UTC, Malte wrote: This compiles with DMD, however it returns random numbers instead of the value I passed in. Looks like a bug to me. Should that work or is there any other pattern I could use for that? Filed as

Remove closure allocation

2018-05-26 Thread Malte via Digitalmars-d-learn
I was trying to get a function that has a closure allocation to compile with @nogc. Assuming this function: int identity(immutable int q) pure nothrow @safe { import std.algorithm; static immutable auto arr = [42]; int getSecondArgument(int a, int b) { return b; }