www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8217] New: static nested class can reference outer scope by template instantiation

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 puremagic.com
        ReportedBy: timon.gehr gmx.ch



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: -------
Jun 10 2012