If you insist (as an earlier poster did) that you first write an assert, then you would avoid this ¡°compilation only¡± worry (as long
as your assert is non-trivial).
I remember seeing that post but I forgot to respond -- that's a good idea that I've never tried. Done properly that should provide the necessary guarantees.