libstdc++: Make make-unsigned-like-t<__int128> work [PR 96042]
authorJonathan Wakely <jwakely@redhat.com>
Wed, 19 Aug 2020 19:36:10 +0000 (20:36 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 19 Aug 2020 19:36:10 +0000 (20:36 +0100)
commite6e01618e83bcd9eb3a2b27df30ed87106a748b4
tree59cd46e74d878fe3800ca553e434e8adcc1cb92b
parent23ebfda0e352fa0a92c6b012458ecb65505a135f
libstdc++: Make make-unsigned-like-t<__int128> work [PR 96042]

As well as ensuring that numeric_limits<__int128> is defined, we need to
ensure that make-unsigned-like-t and to-unsigned-like work correctly for
128-bit integers in strict mode. This ensures that a subrange created
from an iota_view's iterator and sentinel can represent its size.

Co-authored-by: Patrick Palka <ppalka@redhat.com>
libstdc++-v3/ChangeLog:

2020-08-19  Jonathan Wakely  <jwakely@redhat.com>
    Patrick Palka  <ppalka@redhat.com>

PR libstdc++/96042
* include/bits/range_access.h (__detail::__to_unsigned_like):
Do not use make_unsigned_t<T> in the return type, as it can
result in an error before the integral<T> constraint is checked.
[__STRICT_ANSI__]: Add overloads for 128-bit integer types.
(__detail::__make_unsigned_like_t): Define as the return type
of __to_unsigned_like.
* testsuite/std/ranges/subrange/96042.cc: New test.
libstdc++-v3/include/bits/range_access.h
libstdc++-v3/testsuite/std/ranges/subrange/96042.cc [new file with mode: 0644]