http://d.puremagic.com/issues/show_bug.cgi?id=11240
Summary: assumeSafeAppend could implicitly break immutablity
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: druntime
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Kenji Hara <[email protected]> 2013-10-12 23:49:53 PDT ---
I think assumeSafeAppend should reject array references which has non-mutable
element type.
Test case:
import std.stdio;
void main()
{
immutable(int[]) arr = [1,2,3];
immutable(int)[] a = arr[0..2];
writeln("a.capacity = ", a.capacity); // == 0
a = assumeSafeAppend(a[]);
writeln("a.capacity = ", a.capacity); // != 0
a ~= 100;
writeln(a); // [1, 2, 100]
writeln(arr); // [1, 2, 100] <-- !!
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------