[Issue 6816] New: [CTFE] nested function can't access this

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 16 00:21:05 PDT 2011


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

           Summary: [CTFE] nested function can't access this
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dawg at dawgfoto.de


--- Comment #0 from dawg at dawgfoto.de 2011-10-16 00:20:10 PDT ---
struct S
{
    size_t foo()
    {
        size_t nested()
        {
            return value + 1;
        }
        return nested();
    }

    size_t value;
}

enum s = S().foo();

----

It seems as if checking callers in ThisExp::interpret would work.

    while (istate && !istate->localThis)
        istate = istate->caller;

Errors for a wrong 'this' will/should be detected during semantic.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list