[Issue 5773] New: sort() and topN() fail on sliced/resized array of tuples

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 23 12:55:23 PDT 2011


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

           Summary: sort() and topN() fail on sliced/resized array of
                    tuples
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: magnus at hetland.org


--- Comment #0 from Magnus Lie Hetland <magnus at hetland.org> 2011-03-23 12:52:03 PDT ---
Sample program:

import std.algorithm, std.typecons;
void main() {
    alias Tuple!(real,uint) entry;
    auto entries = new entry[100];
    foreach (i, ref e; entries) {
        e[0] = 3.14*i;
        e[1] = i;
    }
    entries = entries[1 .. $];
    // sort(entries);
    // topN(entries, 50);
}

When uncommented (on their own), the sort statement gives a segmentation fault,
and the topN statement gives the error "object.Exception at src/rt/arraycat.d(40):
overlapping array copy".

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