On Monday, 27 June 2016 at 22:56:41 UTC, Jonathan M Davis wrote:
On Monday, June 27, 2016 18:55:48 deadalnix via Digitalmars-d wrote:
On Monday, 27 June 2016 at 18:14:26 UTC, Timon Gehr wrote:
> [...]

Alright, I have to range myself with most here. While I'm all for not warning about unreachable code, I'm opposed to not compiling the rest of the code. This create non orthogonality between static if and control flow analysis, the kind that clearly do not pay for itselfr

Agreed. The code outside of the static if should be compiled regardless, because it's not part of the static if/else at all and therefore has not been marked as conditionally compilable. But if we don't warn about unreachable code, then the code after the static if can clearly be optimized out because it's unreachable. So, Andrei's code would become legal as long as the only problem with the code after the static if was that it was unreachable.

- Jonathan M Davis

It is true that that such unreachable warning can be annoying at times. However it catches bugs. Especially in generic code Those warnings can be a blessing rather then a curse.

We should not swallow or gag errors!

Reply via email to