https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101587
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- In theory yes, but it's unlikely to be a problem in practice because the library doesn't need to compare unsigned types with negative values. If it does need to do that, it is either already doing so carefully and correctly, or this helper wouldn't make things worse. I'm not suggesting designing a general purpose replacement for std::min that handles all the possible corner cases, I'm just suggesting a convenience function for our own internal needs. All the uses in <bits/ranges_uninitialized.h> are with iterator difference types, which had better be signed, and distance(first, last) had better be non-negative too. include/bits/hashtable_policy.h does: const auto __max_width = std::min<size_t>(sizeof(size_t), 8); This is mixing unsigned and signed, but both positive. include/bits/locale_conv.h: auto __nn = std::min<streamsize>(this->epptr() - this->pptr(), __n - __done); This compares ptrdiff_t with streamsize, which are both signed (and both values here are guaranteed to be non-negative by construction).