Hi All, I have got a warning by compiling ("gdc file -Wall") the following code ---------------------------------------------------------- module unreachable; class Foo { this(int i) {} this(char[] s) {} this(char[] s, int flag) { if (flag == 1) { this(1); return; } else if (flag == 2) { this("hello"); return; } throw new Exception("unhandled case"); this(0); // fake } } void main() { Foo foo = new Foo("world", 1); assert(false, "END"); } -----------------------------------------------------------
The warning is: "statement is not reachable" If I use switch-case-statment, I can see even an error message: "constructor calls not allowed in loops or after labels" So, is my design incorrect, or is the compiler too strict? --Qian Xu