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

          Issue ID: 19026
           Summary: Aliasing an inner function gets context but aliasing a
                    member function through instance does not
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: ali.akhtarz...@gmail.com

Based on this forum thread:
https://forum.dlang.org/thread/hyforteterjqhgghp...@forum.dlang.org

Aliasing an inner function seems inconsistent with aliasing a member function
in that the former aliases the contexted function whereas the latter not:

void main() {
    struct S { void f() {} }
    S s;
    void f() {}

    alias inner = f;
    alias member = s.f;

    pragma(msg, typeof(&inner)); // delegate
    pragma(msg, typeof(&member)); // function
}

so inner() can be called but not member() as you get: Error: need this for f of
type void()

--

Reply via email to