[Issue 19026] New: Aliasing an inner function gets context but aliasing a member function through instance does not
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 26 03:33:43 UTC 2018
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: nobody at puremagic.com
Reporter: ali.akhtarzada at gmail.com
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()
--
More information about the Digitalmars-d-bugs
mailing list