https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88895
--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> --- (In reply to Martin Sebor from comment #2) > The warning is not specific to C++ but triggers for C code as well True, but C++ templates somehow make this different. In C, you could use the preprocessor to test for the size of int. In C++, expecting the compiler to silently get rid of useless cases (like x<0 tests when the function is instantiated with an unsigned type for x) is normal in templates. Starting with C++17 you could use if constexpr, although the lack of switch constexpr makes it less readable.