www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6407] New: take(map) problem

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6407

           Summary: take(map) problem
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2011-07-30 06:55:01 PDT ---
D2 code:


import std.stdio, std.algorithm, std.range;
auto foo(int p) {
    return map!((int n){ return p; })(iota(3));
}
void main() {
    writeln(take(foo(2), 20));
}


To me it prints:
[4221068, 4221068, 4221068]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 30 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6407



--- Comment #1 from bearophile_hugs eml.cc 2011-07-31 07:01:58 PDT ---
A comment by Daniel Murphy:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=28553

 The problem is the parameter p is not being heap allocated.  I'm fairly sure
 it's already in bugzilla, something about failing to detect escaping
 references with alias parameters.

-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 31 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6407


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh quickfur.ath.cx


--- Comment #2 from hsteoh quickfur.ath.cx 2013-07-01 12:12:15 PDT ---
This bug appears to be fixed in latest git HEAD (and probably last release as
well)? Bearophile, could you re-test this against the latest release and close
the bug if it doesn't happen anymore?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 01 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6407


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |monarchdodra gmail.com
         Resolution|                            |FIXED


--- Comment #3 from monarchdodra gmail.com 2013-07-01 12:49:39 PDT ---
(In reply to comment #2)
 This bug appears to be fixed in latest git HEAD (and probably last release as
 well)? Bearophile, could you re-test this against the latest release and close
 the bug if it doesn't happen anymore?

Works for me for as far back as at least 2.061. I'll close it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 01 2013