Bug 12222 – "alias this" ignored for aliased methods

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-21T21:35:56Z
Last change time
2024-12-13T18:17:19Z
Assigned to
No Owner
Creator
Vladimir Panteleev
Moved to GitHub: dmd#18779 →

Comments

Comment #0 by dlang-bugzilla — 2014-02-21T21:35:56Z
///// test.d ///// struct S { void f() {} } struct W { S s; alias s this; alias f = s.f; } void main() { W w; w.f(); } ////////////////// Compiler complains: test.d(16,2): Error: this for f needs to be type S not type W However, there is an "alias this" it W to S which should allow the method to be called with S as the "this" type.
Comment #1 by razvan.nitu1305 — 2018-11-05T11:41:48Z
Why would you even do that? Isn't the alias this enough?
Comment #2 by dlang-bugzilla — 2018-12-27T20:56:45Z
I don't remember for certain, but I think it is so that f can be passed as an alias parameter to a method of W.
Comment #3 by robert.schadek — 2024-12-13T18:17:19Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18779 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB