[Issue 17156] New: Local function declaration not inferred to be static

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Feb 8 00:13:52 PST 2017


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

          Issue ID: 17156
           Summary: Local function declaration not inferred to be static
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: eyal at weka.io

void f() {
    uint function() a = () => 5; // OK

    static uint s() { return 5; }
    uint function() b = &s; // ALSO OK

    uint g() { return 5; }
    uint function() c = &g; // BOOM! "&g" is a delegate. why?
}


There should not really be a difference between "s" and "g". The "static" there
should be inferred from lack of any lexical capture.

--


More information about the Digitalmars-d-bugs mailing list