July 31, 2018 [Issue 19130] Disabling opAssign in aliasing struct hides all opAssigns in subtyped alias | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19130 Steven Schveighoffer <schveiguy@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |schveiguy@yahoo.com Resolution|--- |INVALID --- Comment #1 from Steven Schveighoffer <schveiguy@yahoo.com> --- Works as designed. As I mentioned in the forum thread, when you override one overload of a base function, you override them all. With classes, you can alias in the base class definitions of the function, but with alias this, that is not an option (there will be a `this` type mismatch). The workaround is to forward the other overloads back to the base. e.g.: auto opAssign(int x) { return a.opAssign(x); } -- |
Copyright © 1999-2021 by the D Language Foundation