www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13091] New: nothrow std.algorithm.cartesianProduct

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

          Issue ID: 13091
           Summary: nothrow std.algorithm.cartesianProduct
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

void main() pure nothrow  safe  nogc {
    import std.algorithm: cartesianProduct;
    int[1] a = [1];
    foreach (t; cartesianProduct(a[], a[])) {}
}


dmd 2.066beta2 gives me:

test.d(4,33): Error: pure function 'D main' cannot call impure function
'std.algorithm.cartesianProduct!(int[], int[]).cartesianProduct'
test.d(4,33): Error:  nogc function 'D main' cannot call non- nogc function
'std.algorithm.cartesianProduct!(int[], int[]).cartesianProduct'
test.d(4,5): Error: pure function 'D main' cannot call impure function
'std.algorithm.joiner!(MapResult!(__lambda3, int[])).joiner.Result.popFront'
test.d(4,5): Error:  nogc function 'D main' cannot call non- nogc function
'std.algorithm.joiner!(MapResult!(__lambda3, int[])).joiner.Result.popFront'
test.d(4,33): Error: 'std.algorithm.cartesianProduct!(int[],
int[]).cartesianProduct' is not nothrow
test.d(4,5): Error: 'std.algorithm.joiner!(MapResult!(__lambda3,
int[])).joiner.Result.popFront' is not nothrow
test.d(1,6): Error: function 'D main' is nothrow yet may throw

--
Jul 10 2014