In SortedRange, there is a debug clause in the constructor which checks the sortedness of the input. The final assert assumes it can print the range if the sortedness isn't true. However, a range of types that do not define toString will fail to compile, even if the range can be sorted. For example: interface I {} auto sr = SortedRange!(I[]); The fix is simple, do the assert without printing the range (from range.d line 5400 in dmd 2.052): - assert(isSorted!pred(st), text(st)); + static if(is(typeof(text(st)))) + assert(isSorted!pred(st), text(st)); + else + assert(isSorted!pred(st)); This is another case of bug 4901, but I didn't see it because I normally don't compile with -debug enabled. See http://www.dsource.org/projects/dcollections/ticket/13 for the error listing.
https://github.com/D-Programming-Language/phobos/pull/2028
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/ee2d46263bedd6b58663fa710690f5339d7b5ca0 Issue 5870 - Debug code in SortedRange assumes it can always print the range https://github.com/D-Programming-Language/phobos/commit/2644eb9081f778ae20fdc6473d868b879c83208a Merge pull request #2028 from Infiltrator/patch-1 Issue 5870 - Debug code in SortedRange assumes it can always print the ...