[Issue 12169] New: sum(int[]) should return a int

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 15 01:44:04 PST 2014


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

           Summary: sum(int[]) should return a int
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          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 01:44:01 PST ---
import std.algorithm: sum;
void main() {
    int[] arr1;
    auto arr2 = new int[arr1.sum];
}


With dmd 2.065beta3 gives:

test3.d(4,25): Error: cannot implicitly convert expression (sum(arr1)) of type
long to uint

It seems a sum(int[]) gives a long. 99% of the cases this is not what I need.

-- 
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