www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20921] New: Cannot get frame pointer in templated static

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

          Issue ID: 20921
           Summary: Cannot get frame pointer in templated static member
                    function
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: simen.kjaras gmail.com

struct S {
    int i;

    void fun() {
        // Works fine
        outside!(() => i);
        // staticInside cannot access frame of function S.fun
        staticInside!(() => i);
    }

    static void staticInside(alias fn)() {
        fn();
    }
}
void outside(alias fn)() {
    fn();
}

Since static member functions should be equivalent to free functions, the above
clearly should compile, but as indicated by comments, it does not.

--
Jun 11