Issue 1974 - What's your opinion?
kinke
noone at nowhere.com
Sat Oct 26 15:30:13 UTC 2019
On Saturday, 26 October 2019 at 14:41:38 UTC, John Colvin wrote:
> I think the lowering is a distraction.
>
> += on an rvalue is invalid, so the lowering should never happen.
>
> The implementation of operator overloads may be done with
> regular functions, but the "interface" of += doesn't make sense
> on an rvalue. If you want to call your opOpAssign on an rvalue,
> that's fine, but that's not the same as +=
Exactly what I'm thinking. Implementation-wise, it's probably not
that hard to perform the lhs-lvalue check before lowering.
C++ btw allows rvalues: https://godbolt.org/z/qZ3qrj
More information about the Digitalmars-d
mailing list