September 13, 2019 [Issue 1974] overloaded assignment operators work on non-lvalues | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=1974 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1305@gmail.com --- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> --- This is a bit problematic because there are 2 points of view on this: 1. From a high-level point of view, the bug report is valid, you are trying to assign to an rvalue (x.test() = x.test() + 1337) which should an error. 2. From a lowering point of view you are basically calling the member function of a temporary object (x.test.opAddAssign(1337)), which by the current rules is valid behavior. I guess that what could be implemented is something along the lines of: if the opAssign/op*Assign function is pure, then you can error/warn because the call has no effect, otherwise it is possible that the assign function has side effects so calling it is correct. Anyhow, maybe I am over-engineering this? -- |
October 24, 2019 [Issue 1974] overloaded assignment operators work on non-lvalues | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=1974 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #2 from RazvanN <razvan.nitu1305@gmail.com> --- Closing on the basis of: https://forum.dlang.org/post/hyacdnjwraldlnmdlpwc@forum.dlang.org -- |
Copyright © 1999-2021 by the D Language Foundation