Hi Vittorio, wonderful to see you here after C++Now! :)

On 05/20/2017 09:08 PM, Vittorio Romeo wrote:

>consider this code:
>
>     void delegate()[] arr;
>
>     foreach(i; 0..5)
>     {
>         arr ~= () => writeln(i);
>     }
>
>     foreach(f; arr)
>     {
>         f();
>     }
>
> This is going to print "4 4 4 4", which might be the desired behavior.

It's a bug. :/

  https://issues.dlang.org/show_bug.cgi?id=8621

Ali

Reply via email to