[Issue 4877] New: Hole in Const System: popFront()
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Sep 16 17:38:35 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4877
Summary: Hole in Const System: popFront()
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: dsimcha at yahoo.com
--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2010-09-16 17:38:03 PDT ---
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.
--
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