[Issue 16473] operator overloading is broken

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Sep 25 05:07:38 PDT 2016


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

--- Comment #2 from Илья Ярошенко <ilyayaroshenko at gmail.com> ---
(In reply to Ryan from comment #1)
> I was able to fix it by adding `-` to the list of accepted strings in the if
> statement. So now the function signature looks like this
> --------------------
> auto ref opIndexUnary(string op, Indexes...)(Indexes _indexes)
>             if (isFullPureIndex!Indexes && (op == `++` || op == `--` || op
> == `-`))
> --------------------
> 
> This works for the case reported in the original ticket. Not sure what to do
> about the overload that takes slices. The semantically typical thing to do
> would be return a new slice with a new array underneath it that has the
> negated values, so as to not modify the underlying array. But that would
> cause an allocation.

This is a workaround, which generate more template bloat. We need DMD FE bug
fix

--


More information about the Digitalmars-d-bugs mailing list