I have the following program on Mac OS X 10.6.3 running dmd version 2.043: $ cat if.d import std.stdio;
void main (string [] args) { foreach(arg; args) writeln(arg); auto vec = new double[10]; foreach(i, ref x; vec) { x = cast(double) i; } if (args.length > 1 && args[1] == "bar") { vec[] *= 0.5; } } This program compiles with no warnings. However, when I run it, I get a bus error regardless of the value of the first command-line argument, or whether it's present at all. I also get bus error if I eliminate the conditional altogether. AFAICT, the array operation I'm doing on vec is legitimate according to http://www.digitalmars.com/d/2.0/arrays.html and the fact that the program bombs out regardless of the outcome of the test in the conditional is particularly mystifying. Any help would be greatly appreciated. Thanks, Pillsy