deadalnix:
That is reasonable to expect a compiler to remove such a check with optimization enabled already. I'm not sure about DMD, but I'd be willing to bet that LDC and GDC already do it.
I think this thread is about an enhancement request for a guaranteed front-end optimization.
Bye, bearophile