Bug 19026 – Aliasing an inner function gets context but aliasing a member function through instance does not

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-06-26T03:33:43Z
Last change time
2024-12-13T18:59:17Z
Assigned to
No Owner
Creator
Ali Ak
Moved to GitHub: dmd#17866 →

Comments

Comment #0 by ali.akhtarzada — 2018-06-26T03:33:43Z
Based on this forum thread: https://forum.dlang.org/thread/[email protected] 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()
Comment #1 by robert.schadek — 2024-12-13T18:59:17Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17866 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB