[Issue 5064] Crash related to std.algorithm.map, delegates, and casts

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 16 13:44:38 PDT 2010


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


klickverbot <code at klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code


--- Comment #1 from klickverbot <code at klickverbot.at> 2010-10-16 13:44:03 PDT ---
The foreach loop is not needed, another temporary »works« as well:

---
import std.algorithm;

void main() {
   auto a = 1;
   auto dg = ( uint c ){ return cast( dchar )a; };

   // This works:
   dg( 1 );

   // This crashes:
   map!( ( c ){ return dg( c ); } )( [ 1 ] );
}
---

GDB prints the innermost frame like this:
0x08049846 in ave.main.__dgliteral2!(int).__dgliteral2 (this=0x0, c=1) at
ave.d:11

Note that this is null – could this be an issue, or is this relative to the
current frame?

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