[Issue 19130] Disabling opAssign in aliasing struct hides all opAssigns in subtyped alias

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 31 20:44:08 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19130

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |schveiguy at yahoo.com
         Resolution|---                         |INVALID

--- Comment #1 from Steven Schveighoffer <schveiguy at 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); }

--


More information about the Digitalmars-d-bugs mailing list