Bug 4877 – Hole in Const System: popFront()

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-09-16T17:38:00Z
Last change time
2010-09-17T05:17:42Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2010-09-16T17:38:03Z
Apparently using ref array parameters/implicit conversions gets around const in this example. void popFront(T)(ref T[] arr) { arr = arr[1..$]; } void main() { immutable arr = [1,2,3,4,5].idup; arr.popFront(); assert(arr == [2,3,4,5]); // PASSES } Please take your time fixing this, though, as much of std.range relies on this bug to work correctly with const/immutable arrays.
Comment #1 by smjg — 2010-09-17T05:17:42Z
*** This issue has been marked as a duplicate of issue 3534 ***