Thread overview | |||||
---|---|---|---|---|---|
|
January 28, 2019 [Issue 19615] alias this not taken when member is | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19615 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1305@gmail.com --- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> --- I don't think this issue is valid. Alias this should be viewed as inheritance, so your example should behave exactly as: class Test1 { int member() { return 0; } } class Test2 : Test1 { int member(int n) { return n; } } void main() { Test2 a; a.member(); // error : function test.Test2.member(int n) is not callable using argument types () } Currently, in dmd if you want to include an overload in the baseclass overload set you have to use alias (alias member = typeof(super).member), then the example compiles. I suggest you use this technique in your code. I suggest we close this as invalid. -- |
January 30, 2019 [Issue 19615] alias this not taken when member is | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19615 --- Comment #2 from Bolpat <qs.il.paperinik@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 -- |
December 17, 2022 [Issue 19615] alias this not taken when member is | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19615 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P4 -- |
Copyright © 1999-2021 by the D Language Foundation