[Issue 6982] immutability isn't respected on array assignment

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 21 08:31:13 PST 2011


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


timon.gehr at gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |timon.gehr at gmx.ch
         Resolution|                            |INVALID


--- Comment #1 from timon.gehr at gmx.ch 2011-11-21 08:30:21 PST ---
That works as designed. I do not understand what you would expect it to do.

immutable(Bla[]) _a; // this is an array that cannot be changed
immutable(Bla)[] a; // this is an array whose elements cannot be changed

a = _a; // fine. a is now a slice to _a's data

a.length = 5; // reallocate storage for a.
assert(_a.length == 0); // length of _a does not change as it is a different
variable

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