Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aliasing an inner function gets context but aliasing a member function through instance does not #17866

Open
dlangBugzillaToGithub opened this issue Jun 26, 2018 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

Ali Ak reported this on 2018-06-26T03:33:43Z

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

CC List

Description

Based on this forum thread: https://forum.dlang.org/thread/hyforteterjqhgghpshw@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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant