There is such a thing as compile-time asserts. In C++ that typically means static_assert, or in C various macros like C_ASSERT are used. These are used precisely for finding mistakes at compile time, without having to debug the program. That is what should be used in this case.
Also, compile-time asserts are meant to be enabled for all project build types, which is fine since they have no run-time impact.
Make sure you test your function for an input value of -2147483648. An implementation that does not use an unsigned type internally will normally fail with that value, asuming 32-bit ints.