The following example worked with DMD 2.081.0 but fails to compile with 2.082.0 and later: import std.algorithm; void main() { [1, 2,].sort.sort; } The error message is: phobos/std/algorithm/sorting.d(1877): Error: cannot implicitly convert expression assumeSorted(r) of type SortedRange!(int[], "a < b") to SortedRange!(SortedRange!(int[], "a < b"), "a < b") main.d(5): Error: template instance `std.algorithm.sorting.sort!("a < b", cast(SwapStrategy)0, SortedRange!(int[], "a < b"))` error instantiating
A temporary workaround is to do: arr.sort.release.sort
Looks like something like https://github.com/dlang/phobos/blob/master/std/complex.d#L656 would help here. /* Makes Complex!(Complex!T) fold to Complex!T. The rationale for this is that just like the real line is a subspace of the complex plane, the complex plane is a subspace of itself. Example of usage: --- Complex!T addI(T)(T x) { return x + Complex!T(0.0, 1.0); } --- The above will work if T is both real and complex. */ template Complex(T) if (is(T R == Complex!R)) { alias Complex = T; }
This was introduced by https://github.com/dlang/phobos/pull/6535.
PR: https://github.com/dlang/phobos/pull/6748
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/a8e9857756e1b1db5735c31c2085569c95a7d6e6 fix Issue 19337 - cannot call std.algorithm.sort twice - introduced with #6535 which stripped nested SortedRange types in assumeSorted, thus causing a mismatch between the return type of sort (SortedRange!(SortedRange!R)) and assumeSorted SortedRange!R - fix by stripping nested SortedRange types in the SortedRange!R template instantiation https://github.com/dlang/phobos/commit/ef206af1a0ae841724a38682d1e0073e631d4b3d Merge pull request #6748 from MartinNowak/fix19337 fix Issue 19337 - cannot call std.algorithm.sort twice