[Issue 14442] Wrong this.outer reference in nested classes

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Apr 13 02:32:59 PDT 2015


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

--- Comment #3 from Iain Buclaw <ibuclaw at gdcproject.org> ---
(In reply to Dicebot from comment #2)
> Is it effectively another manifestation of "have one context pointer, need
> many" issue?

Maybe... though in this scenario you can get away with just the one context
pointer:

anonclass this
{
    void *this (bar.__closptr)
    {
        Foo35 this
        {
            int x = 42;
        }
        int y = 43;
    }
}


So you know that the following:

assert(x == 42);
assert(y == 43);

Is lowered to:

assert((cast(Foo35)(*cast(CLOSURE bar *)this.this)).x == 42);
assert((cast(CLOSURE bar *)this.this).y == 43);

--


More information about the Digitalmars-d-bugs mailing list