Trying to help someone on SO, I ran into problems.<br><br>On a 64-bit Linux machine, with DMD 2.055<br><br>This gives: '/Internal error: ../ztc/cg87.c 202'<br>void main(){<br><br> auto f = (double m){ static double sum = 0.0; return sum += m * m; };<br>
double[] a = array(map!f(iota(1.0, 25.0, 1.0)));<br> writeln(a);<br>}<br><br><br>This one compiles but I get Segmentation fault.<br>void main(){<br><br> auto f = (double m){ /* static double sum = 0.0;*/ return m * m; };<br>
double[] a = array(map!f(iota(1.0, 25.0, 1.0)));<br> writeln(a);<br> }<br><br><br>This one compiles and runs.<br> void main(){<br><br> auto f = (double m){ /* static double sum = 0.0;*/ return m * m; };<br> double[] a = array(map!f(array(iota(1.0, 25.0, 1.0))));<br>
writeln(a);<br> //works<br> }<br><br><br>Putting everything together, I still get 'Internal error: ../ztc/cg87.c 202' with this one.<br>void main(){<br><br> auto f = (double m){ static double sum = 0.0; return sum += m * m; };<br>
double[] a = array(map!f(array(iota(1.0, 25.0, 1.0))));<br> writeln(a);<br>}<br><br><br><br>