[Issue 13615] New: stable sort not usable in @safe code
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Oct 13 23:31:28 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13615
Issue ID: 13615
Summary: stable sort not usable in @safe code
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: braddr at puremagic.com
Adding safe to the stable sort unit tests, as follows:
@safe unittest
{
// Showcase stable sorting
string[] words = [ "aBc", "a", "abc", "b", "ABC", "c" ];
sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable)(words);
assert(words == [ "a", "aBc", "abc", "ABC", "b", "c" ]);
}
std/algorithm.d(10241): Error: safe function
'std.algorithm.__unittestL10237_301' cannot call system function
'std.algorithm.sort!("toUpper(a) < toUpper(b)", cast(SwapStrategy)2,
string[]).sort'
I see no direct tests for either the quicksortimpl or timsortimpl, which is
itself a problem. Creation of tests for both of those impls and having them
marked @safe should be a part of fixing this issue.
--
More information about the Digitalmars-d-bugs
mailing list