D.gnu - foreach loop over retro can crash gdmd
- Joseph Rushton Wakeling (23/23) Jun 28 2012 Hello all,
Hello all, The following code crashes my version of GDC (4.6.3) when I try and compile it: //////////////////////////////////////////////////// import std.range, std.stdio; void main() { double[] a = [ 0, 1, 2, 3, 4, 5 ]; foreach(i, x; retro(a)) writeln(x); } //////////////////////////////////////////////////// It specifically requires the two-variable foreach() loop: if I just have, foreach(x; retro(a)) then it compiles and runs without problem. If I specify the variable types, foreach(size_t i, double x; retro(a)) then it fails to compile with an error: retro.d:7: Error: cannot infer argument types This last error also occurs if I try to compile the original code with the latest (from GitHub) DMD. I imagine that means that the crash is also fixed in the latest GDC, but just checking :-) Thanks & best wishes, -- Joe
Jun 28 2012