[Issue 8217] New: static nested class can reference outer scope by template instantiation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 10 13:37:44 PDT 2012


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

           Summary: static nested class can reference outer scope by
                    template instantiation
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: timon.gehr at gmx.ch


--- Comment #0 from timon.gehr at gmx.ch 2012-06-10 13:39:50 PDT ---
class D{
    int x;
    template bar(){
        int foo(){
            return x;
        }
    }
    static class C{
        int foo(){
            return bar!().foo();
        }
    }
}

C does not have a reference to the enclosing context, therefore the call to
bar!().foo is invalid.
DMD 2.059 accepts the code.

-- 
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