https://issues.dlang.org/show_bug.cgi?id=21183
Issue ID: 21183
Summary: schwartzSort does not strip const
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: minor
Priority: P1
Component: phobos
Assignee: [email protected]
Reporter: [email protected]
Consider the following code:
import std.algorithm : schwartzSort;
import std.array : array;
struct S
{
int i;
const(int) foo() { return i; }
}
void main()
{
auto list = [S(4), S(3), S(2)];
assert(list.dup.schwartzSort!(a => a.foo).array == [S(2), S(3), S(4)]);
}
This leads to cryptic errors due to the fact that `schwartzSort` does not strip
the `const` from `const(int)` for its internal array, even though it trivially
could since it's a value type.
--