[Issue 5710] cannot use delegates as parameters to non-global template

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jun 14 09:20:18 PDT 2014


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

--- Comment #38 from Sobirari Muhomori <dfj1esp02 at sneakemail.com> ---
(In reply to Martin Nowak from comment #34)
> It's still challenging to implement all the IR gen for this.

BTW, looks like all the code generation was there for ages:

struct A
{
    int a;
    int delegate() foo()
    {
        int b;
        int bar()
        {
            return a+b;
        }
        int delegate() d=&bar;
        b=1;
        return d;
    }
}

Here nested function `bar` accesses both stack variable `b` and member field
`a` through single context pointer in delegate `d` as if it has two contexts -
closure pointer and `this` pointer.

--


More information about the Digitalmars-d-bugs mailing list