[Issue 16426] Templated opAssign do not forward on Alias this.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Sep 4 12:14:51 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=16426
Steven Schveighoffer <schveiguy at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |schveiguy at yahoo.com
--- Comment #2 from Steven Schveighoffer <schveiguy at yahoo.com> ---
Ran into this today.
If the compiler is going to generate an opAssign, it should generate one that
forwards to the alias-this member. It should be something equivalent to adding
the following overload to the existing generated opAssign:
auto ref opAssign(T)(auto ref T val) if (!is(T == typeof(this)) &&
__traits(compiles, aliasThisMember = val))
{
aliasThisMember = val;
}
BTW, thanks for the workaround. For a wrapped single alias-this member, it
works perfectly.
--
More information about the Digitalmars-d-bugs
mailing list