[Issue 16473] operator overloading is broken

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Sep 24 18:50:48 PDT 2016


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

--- Comment #1 from Ryan <clumsycodemonkey at gmail.com> ---
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.

--


More information about the Digitalmars-d-bugs mailing list