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