///// 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.
Why would you even do that? Isn't the alias this enough?
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.
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