Bug 4934 – Cannot compile an overloaded operator returning by ref

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2010-09-24T07:35:00Z
Last change time
2010-09-25T18:19:48Z
Assigned to
nobody
Creator
samukha

Comments

Comment #0 by samukha — 2010-09-24T07:35:00Z
struct QString { ref QString opOpAssign(string op : "+")(ref QString s) { return this; } } void main() { QString s; s += s; // fails s.opOpAssign!("+")(s); // compiles } test.d(12): Error: variable test.QString.op only parameters or foreach declarations can be ref Compiles if the return type is omitted or the operator is called explicitly.
Comment #1 by rsinfu — 2010-09-25T18:19:48Z
*** This issue has been marked as a duplicate of issue 4041 ***