Bug 10428 – Assignment operator returns by value (not by ref like you'd expect)

Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-20T14:02:16Z
Last change time
2021-05-11T09:23:33Z
Assigned to
No Owner
Creator
Tommi

Comments

Comment #0 by tommitissari — 2013-06-20T14:02:16Z
Assignment operators should return by ref, not by value. void edit(ref int) { } void main() { int n; edit(n += 4); // OK edit(n = 4); // [1] } --- 1) Error: function main.edit (ref int _param_0) is not callable using argument types (int)
Comment #1 by razvan.nitu1305 — 2021-05-11T09:23:33Z
This code compiles succesfully today. Closing as w4m.