Yes, I'm not sure either, actually my question was only for the last code sample. I thought the compiler is sure that the exception will be thrown and the last statement will be unreachable, but it seems that's not true.
It may be easy for a human being to spot that the last two code examples are identical, but it's not so easy for a compiler. You could make its analysis of which code will definitely be executed (or which won't) as complex as you want, and it will still miss opportunities for proving that some code can't be reached. It has to draw the line somewhere, and that line seems to be trying to prove the constant-ness of "if" condition values.
It would be very annoying to get unreachable statement errors if Debug.enabled is set to false.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
This tiny ad is suggesting that maybe she should go play in traffic.