www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10963] New: filter.save in map changes the behavior of filter


           Summary: filter.save in map changes the behavior of filter
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: ttanjo gmail.com

--- Comment #0 from Tomoya Tanjo <ttanjo gmail.com> 2013-09-04 01:14:17 PDT ---
I apologize to use not descriptive summary but I don't know how to explain this

The following code should work without errors but it doesn't work in dmd
v2.064-devel-6f9a34f and v2.063 on Mac OSX.
It causes AssertError at line 6 at runtime.

import std.algorithm;
import std.range;

auto foo(in int[] ar)
    assert(ar.length == 1);
    return true;

void main(string[] args)
    immutable ar = [0];
    [0].map!(_ => {
            auto r = [0].filter!(_ => foo(ar));
            return 0;

If changing `ar` from immutable to enum, it works.
If using `r.until!"true"` instead of `r.save.until!"true"`, it works.
If using `filter` without `map`, it works.

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