[Issue 5937] New: Problem with map!delegate(iota(floating point))

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 6 15:18:02 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5937

           Summary: Problem with map!delegate(iota(floating point))
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          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 2011-05-06 15:14:07 PDT ---
With DMD 2.052 this gives some access violations:


import std.range, std.algorithm;
void main() {
    auto range1 = iota(0.0, 5.0, 1.0);
    double foo(double x){ return 1.0; };
    auto foor = map!foo(range1);
    foreach (x; foor) {} // OK

    auto range2 = iota(1, 5, 1);
    int bar(int x){ return 1; };
    auto barr = map!bar(range2);
    foreach (x; barr) {} // OK

    float delegate(float) spam1 = (float x){ return 1.0f; };
    auto spamr1 = map!spam1(range1);
    foreach (x; spamr1) {} // object.Error: Access Violation

    double delegate(double) spam2 = (double x){ return 1.0; };
    auto spamr2 = map!spam1(range1);
    foreach (x; spamr2) {} // object.Error: Access Violation

    real delegate(real) spam3 = (real x){ return 1.0L; };
    auto spamr3 = map!spam3(range1);
    foreach (x; spamr3) {} // object.Error: Access Violation
}

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


More information about the Digitalmars-d-bugs mailing list