Would
int foo(int x, int y) { return x+y; }
compile? After all, this function can be called in a way that causes UB. int foo(int x, int y) { return x+y; }
compile? After all, this function can be called in a way that causes UB.(This is the case in e.g. C#.)
Unless your program can prove, that the function is only ever called with arguments that don't hit UB.