[Issue 6611] New: array[]++ and array[]-- too?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 6 03:17:57 PDT 2011


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

           Summary: array[]++ and array[]-- too?
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-09-06 03:17:47 PDT ---
This code contains two operations that are refused by DMD2.055beta:

void main() {
    int[10] a;
    a[] += 1; // OK
    ++a[];    // OK
    --a[];    // OK
    a[]++;    // line 6, error
    a[]--;    // line 7, error
}


test2.d(6): Error: slice expression a[] is not a modifiable lvalue
test2.d(6): Error: 'a[]' is not a scalar, it is a int[]
test2.d(6): Error: cannot cast int to int[]
test2.d(7): Error: slice expression a[] is not a modifiable lvalue
test2.d(7): Error: 'a[]' is not a scalar, it is a int[]
test2.d(7): Error: cannot cast int to int[]


Maybe it's better to allow the last two lines too.

-- 
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