https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92675
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Richard Biener from comment #3) > -1u also works Not in a template: #include <type_traits> template<typename U> constexpr std::enable_if_t<std::is_unsigned<U>::value, bool> is_max(U u) { #ifdef GOOD U max = -1; // good #else U max = -1u; // bad #endif return u == max; } static_assert(is_max(-1ull)); This fails when GOOD isn't defined, because -1u is UINT_MAX not the maximum value for the type. You can use std::numeric_limits<U>::max() or U(-1) but -1 is a convenient shorthand that does the right thing.