www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4877] New: Hole in Const System: popFront()

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: dsimcha yahoo.com



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: -------
Sep 16 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4877


Stewart Gordon <smjg iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |smjg iname.com
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 3534 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 17 2010