www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17156] New: Local function declaration not inferred to be

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 puremagic.com
          Reporter: eyal 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.

--
Feb 08 2017