www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17372] New: function

https://issues.dlang.org/show_bug.cgi?id=17372

          Issue ID: 17372
           Summary: function 'std.algorithm.searching.skipOver!(Result,
                    dstring).skipOver' is not nothrow
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: issues.dlang jmdavisProg.com

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[])

--
May 05 2017