[Issue 11545] New: Aggregate function literal member should not have access to enclosing scope
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Nov 18 17:55:56 PST 2013
    
    
  
https://d.puremagic.com/issues/show_bug.cgi?id=11545
           Summary: Aggregate function literal member should not have
                    access to enclosing scope
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: d+bugzilla at garciat.com
--- Comment #0 from Gabriel Garcia <d+bugzilla at garciat.com> 2013-11-18 17:55:53 PST ---
import std.stdio;
class hello {
    int x = 42;
    // should not have access to `this.*`
    int function() f = function() {
        // accesses `this.x`
        return x;
    };
}
void g(int function() h) {
    writeln(h());
}
void main() {
    auto h = new hello();
    // outputs 42
    writeln(h.f());
    // segfaults
    g(h.f);
}
-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
    
    
More information about the Digitalmars-d-bugs
mailing list