Bug 7100 – rvalue binds to ref argument

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Mac OS X
Creation time
2011-12-12T15:42:00Z
Last change time
2011-12-12T19:55:10Z
Assigned to
nobody
Creator
andrei

Comments

Comment #0 by andrei — 2011-12-12T15:42:36Z
I am sure this bug has been filed, but it doesn't have the right keywords so I couldn't find it. If anyone does, please make that a dupe of this. struct abc { ref abc opAssign(ref abc rhs) { writeln("opAssign"); return this; } } void main(string[] argv) { abc x; x= abc(); } The code shouldn't compile. I fished this one from a lost email from June 6, 2010.
Comment #1 by k.hara.pg — 2011-12-12T19:55:10Z
Current dmd implementation marks struct literal and construction as lvalue. *** This issue has been marked as a duplicate of issue 5889 ***