[Issue 1339] Invariant/const-ness is broken by built-in array properties sort and reverse

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 16 20:06:46 PDT 2010


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


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com
            Summary|Invariant/const-ness is     |Invariant/const-ness is
                   |broken by built-in array    |broken by built-in array
                   |properties                  |properties sort and reverse


--- Comment #9 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-03-16 20:06:45 PDT ---
The length property problems of this bug are fixed via the patch in bug 3637. 
This was incorporated in dmd 2.041.

The original test case for the length was invalid.

the code still prints 4 3 2 0, because it is OK to append to an
invariant(int)[].

A valid test that would have failed prior to 2.041:

import std.stdio;
void main()
{
invariant(int)[] x = [1,2,3,4];
auto y = x;
x.length = x.length - 1;
x.length = x.length + 1;
writeln(y); // prints 1 2 3 4 (prior to 2.041 would print 1 2 3 0)
writeln(x); // prints 1 2 3 0
}

The sort and reverse property bugs remain valid bugs.

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