[Issue 15957] Disabled postblit + template mixin break opAssign with confusing error message

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Apr 28 03:42:53 PDT 2016


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

--- Comment #5 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to Dicebot from comment #4)
> Interesting. Why does it need to create opAssign when post-blit is disabled?

The @disable has no effect on the logic. An opAssign is always generated when
there's a postblit, disabled or not, because opAssign is what the compiler
generates a call to when assigning. The opAssign is constructed out of the
postblit.

> Is it documented anywhere? It sounds very confusing that disabling any
> symbol result in hidden injection of another one in main scope.

The logic for when to create an opAssign() is in the needOpAssign() function in
clone.d.

Unfortunately, changing the logic of this will break existing code, likely a
lot of it, in maddening ways. But that isn't the real root of the problem.

The real root isn't the @disable, it's the auto generation of various member
functions and how they overload (or not) with other functions inside mixin
templates. To overrule the auto generation, provide the symbol, which is the
solution I illustrated.

--


More information about the Digitalmars-d-bugs mailing list