www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20799] New: schwartzSort does not pin transformation results

https://issues.dlang.org/show_bug.cgi?id=20799

          Issue ID: 20799
           Summary: schwartzSort does not pin transformation results with
                    indirections, leading to memory corruption
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: dlang-bugzilla thecybershadow.net
          Reporter: dlang-bugzilla thecybershadow.net

import std.algorithm.sorting;
import std.range;

void main()
{
        auto arr = 1_000_000.iota.retro.array;
        arr.schwartzSort!(
                n => new int(n),
                (a, b) => *a < *b
        );
        assert(arr.isSorted());
}

--
May 06