www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14102] New: Bad 'is not an lvalue' diagnostic in chained

https://issues.dlang.org/show_bug.cgi?id=14102

          Issue ID: 14102
           Summary: Bad 'is not an lvalue' diagnostic in chained -unary
                    and --preincr expressions.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

int test(int x)
{
    return -- -x;           // error: -x is not an lvalue
    return -- - --x;        // error: -(x -= 1) is not an lvalue
    return -- - -- --x;     // error: -((x -= 1 , x) -= 1) is not an lvalue
    return -- - -- -- --x;  // error: -((ref int __assignop1 = x -= 1 ,
__assignop1 = x; , __assignop1 -= 1 , __assignop1) -= 1) is not an lvalue
}

--
Feb 01 2015