Bug 17372 – function 'std.algorithm.searching.skipOver!(Result, dstring).skipOver' is not nothrow
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-05-05T14:35:04Z
Last change time
2018-01-05T13:28:32Z
Assigned to
No Owner
Creator
Jonathan M Davis
Comments
Comment #0 by issues.dlang — 2017-05-05T14:35:04Z
This code fails to compile
import std.algorithm;
import std.range;
import std.uni;
void main()
{
auto a = [["foo bar"], ["baz"]].map!(line => line.joiner(" ")).array.sort!((a, b) => icmp(a, b) < 0);
}
and gives this error:
/usr/include/dmd/std/uni.d(7082): Error: function 'std.algorithm.searching.skipOver!(Result, dstring).skipOver' is not nothrow
/usr/include/dmd/std/uni.d(7055): Error: nothrow function 'std.uni.fullCasedCmp!(Result).fullCasedCmp' may throw
/usr/include/dmd/std/uni.d(7136): Error: template instance std.uni.fullCasedCmp!(Result) error instantiating
qd.d(7): instantiated from here: icmp!(Result, Result)
/usr/include/dmd/std/algorithm/sorting.d(1851): instantiated from here: __lambda2!(Result, Result)
qd.d(7): instantiated from here: sort!((a, b) => icmp(a, b) < 0, cast(SwapStrategy)0, Result[])
/usr/include/dmd/std/algorithm/sorting.d(1863): Error: static assert "Invalid predicate passed to sort: __lambda2"
qd.d(7): instantiated from here: sort!((a, b) => icmp(a, b) < 0, cast(SwapStrategy)0, Result[])