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