https://issues.dlang.org/show_bug.cgi?id=13010
--- Comment #6 from Brad Roberts <[email protected]> --- --- Comment originally from [email protected] --- (In reply to Kenji Hara from comment #4) > By advancing the thought, compiler will be able to generate "statement is > not reachable" warning in else branch of the code. > > void test(ubyte n) > { > immutable int i = n; > if (i >= 0) // const-folding with VRP will optimize the condition to > true. > { ... } > else > { ... } // so the else branch could be determined to "not reachable" > } Such things could be a problem in templates, where the type is different in different instantiations. This causes a warning if you instantiate it with an T=uint: void foo(T)(T n) { if (n >= 0) { /*...*/ } else { /*...*/ } } void main() { foo(1); // OK foo(1u); // Causes a warning } --
