Segfault using

klickverbot see at
Sat Oct 16 13:13:32 PDT 2010

As you might know from the main D NG, I have just started to solve a few 
little programming puzzles with D2/Phobos to test how well especially 
the algorithm/range stuff in Phobos works out in more-or-less real world 
use cases.

To solve a Caesar-cipher related challenge (from, by the 
way), I wrote up the following simple program:

import std.algorithm;
import std.stdio;

enum INPUT = "cqrb lryqna rb fjh, fjh qjamna cqjw axc cqracnnw. qnan, 
hxd wnena twxf qxf oja cx bqroc! xq kh cqn fjh, cqn jwbfna rb 

void main() {
    foreach ( offset; 0..25 ) {
       writeln( map!( ( dchar c ) {
          if ( c < 'a' ) return c;
          if ( 'z' < c ) return c;
          return cast( dchar )( ( ( ( c - 'a' ) + offset ) % 26 ) + 'a' );
       } )( INPUT ) );

Seems reasonable, right? Using DMD 2.049, however, it segfaults in the 
delegate literal. Why this? Have I missed something obvious?

If you don't want to compile it yourself, I have posted the backtrace 


More information about the Digitalmars-d-learn mailing list