[Issue 3375] New: Ternary operator doesn't yield an lvalue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 8 11:20:16 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3375

           Summary: Ternary operator doesn't yield an lvalue
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrei at metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei at metalanguage.com> 2009-10-08 11:20:15 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list