http://d.puremagic.com/issues/show_bug.cgi?id=2939





------- Comment #1 from jarrett.billings...@gmail.com  2009-05-05 00:16 -------
The foreach loop is actually not important.

void f(lazy void dg)
{
        dg();
}

void main()
{
        void foo() { Stdout.formatln("o hai"); }
        f(foo);
        f({Stdout.formatln("lol wut");});
}

Only 'o hai' is printed, 'lol wut' never makes it.

In order to make it work, you have to put parens after the lambda:

f({Stdout.formatln("lol wut");}());

I'm not justifying the compiler's behavior :{ but that's the workaround I've
been using.


-- 

Reply via email to