Thread overview
[Issue 16473] operator overloading is broken
Sep 25, 2016
Ryan
Sep 25, 2016
Ryan
Sep 25, 2016
Ryan
Jan 11, 2020
Basile-z
Mar 21, 2020
Basile-z
September 06, 2016
https://issues.dlang.org/show_bug.cgi?id=16473

Илья Ярошенко <ilyayaroshenko@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|operator overloading is     |operator overloading is
                   |brocken                     |broken

--
September 25, 2016
https://issues.dlang.org/show_bug.cgi?id=16473

Ryan <clumsycodemonkey@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clumsycodemonkey@gmail.com

--
September 25, 2016
https://issues.dlang.org/show_bug.cgi?id=16473

--- Comment #1 from Ryan <clumsycodemonkey@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.

--
September 25, 2016
https://issues.dlang.org/show_bug.cgi?id=16473

Ryan <clumsycodemonkey@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|dmd                         |phobos

--
September 25, 2016
https://issues.dlang.org/show_bug.cgi?id=16473

Илья Ярошенко <ilyayaroshenko@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|phobos                      |dmd

--
September 25, 2016
https://issues.dlang.org/show_bug.cgi?id=16473

--- Comment #2 from Илья Ярошенко <ilyayaroshenko@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

--
September 30, 2016
https://issues.dlang.org/show_bug.cgi?id=16473

--- Comment #3 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/545dfd08d705574928eef96bffb914b646aa74e0 workaround for Issue 16473

https://github.com/dlang/phobos/commit/302632968f164867e4aa08f1cf8b1429a43cf2a6 Merge pull request #4820 from 9il/workaround16473

workaround for Issue 16473

--
October 01, 2016
https://issues.dlang.org/show_bug.cgi?id=16473

--- Comment #4 from github-bugzilla@puremagic.com ---
Commits pushed to stable at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/545dfd08d705574928eef96bffb914b646aa74e0 workaround for Issue 16473

https://github.com/dlang/phobos/commit/302632968f164867e4aa08f1cf8b1429a43cf2a6 Merge pull request #4820 from 9il/workaround16473

--
January 11, 2020
https://issues.dlang.org/show_bug.cgi?id=16473

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |b2.temp@gmx.com
          Component|dmd                         |phobos
         Resolution|---                         |MOVED

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=16473

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--