https://issues.dlang.org/show_bug.cgi?id=13010
--- Comment #4 from Kenji Hara <[email protected]> --- (In reply to Lionello Lunesu from comment #3) > How do you feel about it when the code is changed to this: > > void testvrp(ubyte l) > { > immutable int i = l; > static assert(i >= 0); > } Looks not bad. In my thought, the value of i is not known at compile time, but i >= 0 could be determined to true at compile time with VRP. And, it should be handled in const-folding phase. 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" } --
