Bug 3375 – [tdpl] Ternary operator doesn't yield an lvalue
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2009-10-08T11:20:00Z
Last change time
2015-06-09T05:15:18Z
Assigned to
nobody
Creator
andrei
Comments
Comment #0 by andrei — 2009-10-08T11:20:15Z
Consider:
int x, y;
(true ? x : y) += 5;
This code fails with:
Error: conditional expression true ? x : y is not a modifiable lvalue
When both branches in a ternary expression are lvalues of the same type, the result must be an lvalue.