2 ms·
Compilers generally do delete all scopes where they can detect that UB is certain (assuming that they can't happen and thus those sections are unreachable code)
by PeterisP 5y ago
Compilers generally do delete all scopes where they can detect that UB is certain (assuming that they can't happen and thus those sections are unreachable code) - but they can't detect and delete all scopes where UB is possible given certain input data, that would contradict the halting theorem and all that.