[Issue 3927] array.length++; is an error, but ++array.length compiles

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 22 06:45:41 PST 2012


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


Salih Dincer <salihdb at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |salihdb at hotmail.com


--- Comment #5 from Salih Dincer <salihdb at hotmail.com> 2012-02-22 06:45:38 PST ---
(In reply to comment #4)
> Fixed for D2 only.

void main() {
    int[] array = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ];
    writeln(array, "~", ++array.length,
                  "->", --array.length);
    assert (array.length == 10);        // no problem
    ++array.length;
    --array.length;
    writeln(array, "~", array.length);    
}

DMD version: 2.057
==================
salih at DB-N150-N210-N220:~/d.ders$ ./dene
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]~11->10
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]~10

No problem...

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