Fix Issue 20751 - SortedRange with ref predicate parameters fails

isTwoWayCompatible should accept functions with ref parameters.
This commit is contained in:
MoonlightSentinel 2020-04-26 00:43:37 +02:00
parent 9844c34196
commit 54dbc0668c
No known key found for this signature in database
GPG key ID: 1A1A60AECDC956AB
2 changed files with 24 additions and 11 deletions

View file

@ -2067,6 +2067,17 @@ if (((ss == SwapStrategy.unstable && (hasSwappableElements!Range ||
r.sort();
assert(proxySwapCalled);
}
// https://issues.dlang.org/show_bug.cgi?id=20751
{
static bool refPred(ref int a, ref int b)
{
return a < b;
}
auto sortedArr = [5,4,3,2,1].sort!refPred;
sortedArr.equalRange(3);
}
}
private void quickSortImpl(alias less, Range)(Range r, size_t depth)