[Issue 19615] alias this not taken when member is
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 30 15:41:03 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19615
--- Comment #2 from Bolpat <qs.il.paperinik at gmail.com> ---
In the case of classes, this works. For structs, it does not.
If not
alias member = field.member;
or
alias member = Test1.member;
in Test2, what kind of alias do you think of? I know none. Both don't work.
And for the second example, this is not even slightly possible. The built-in
index operator for alias sequences cannot be rebuilt by means of the language,
i.e. opIndex with statically known argument.
The spec [1] is very vague about alias this, when it works etc. Technically, by
the spec, alias this to a built-in type field need not work: It only includes
structs, classes, and property member function with no parameters. It does not
mention alias sequences at all! One could even argue that it is a bug that
alias this to an alias sequence even works.
[1]: https://dlang.org/spec/class.html#AliasThis
--
More information about the Digitalmars-d-bugs
mailing list