[Bug libstdc++/101587] ranges::uninitialized_copy/move incorrectly uses std::min
hewillk at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jul 23 09:56:20 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101587
--- Comment #2 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to Jonathan Wakely from comment #1)
> Maybe we should add this somewhere and just stop using std::min for integers:
>
> struct __min_fn
> {
> template<typename _Tp, typename _Up>
> typename common_type<_Tp, _Up>::type
> operator()(_Tp __t, _Up __u) const noexcept
> { return std::min<typename common_type<_Tp, _Up>::type>(__t, __u); }
> };
> _GLIBCXX17_INLINE constexpr __min_fn __min{};
It may cause problems when comparing integers with different signedness.
More information about the Gcc-bugs
mailing list