[Issue 12172] New: Refused sum(transversal)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 15 02:01:26 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12172

           Summary: Refused sum(transversal)
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2014-02-15 02:01:19 PST ---
import std.algorithm: reduce, sum;
import std.range: transversal;
alias mySum = reduce!q{a + b};
void main() {
    const data = [[1, 2], [10, 20]];
    mySum(0, data.transversal(0)); // OK
    sum(0, data.transversal(0));   // Error
}


dmd 2.065beta3 gives:

test.d(7,8): Error: template std.algorithm.sum cannot deduce function from
argument types !()(int, Transversal!(const(int[])[],
cast(TransverseOptions)0)), candidates are:
...\dmd2\src\phobos\std\algorithm.d(1070,6):        std.algorithm.sum(R)(R r)
if (isInputRange!R && !isFloatingPoint!(ElementType!R) && !isInfinite!R)
...\dmd2\src\phobos\std\algorithm.d(1115,6):        std.algorithm.sum(R)(R r)
if (hasSlicing!R && hasLength!R && isFloatingPoint!(ElementType!R))
...\dmd2\src\phobos\std\algorithm.d(1145,6):        std.algorithm.sum(R)(R r)
if (isInputRange!R && !(hasSlicing!R && hasLength!R) &&
isFloatingPoint!(ElementType!R) && !isInfinite!R)

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list