D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3375 - [tdpl] Ternary operator doesn't yield an lvalue
Summary: [tdpl] Ternary operator doesn't yield an lvalue
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-08 11:20 UTC by Andrei Alexandrescu
Modified: 2015-06-09 05:15 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrei Alexandrescu 2009-10-08 11:20:15 UTC
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.
Comment 1 Walter Bright 2009-12-06 00:51:14 UTC
Fixed dmd 2.037