[committed] libstdc++: Make __int128 meet integer-class requirements [PR 96042]

Jonathan Wakely jwakely@redhat.com
Wed Aug 19 19:36:40 GMT 2020


On 19/08/20 17:00 +0100, Jonathan Wakely wrote:
>Because __int128 can be used as the difference type for iota_view, we
>need to ensure that it meets the requirements of an integer-class type.
>The requirements in [iterator.concept.winc] p10 include numeric_limits
>being specialized and giving meaningful answers. Currently we only
>specialize numeric_limits for non-standard integer types in non-strict
>modes.  However, nothing prevents us from defining an explicit
>specialization for any implementation-defined type, so it doesn't matter
>whether std::is_integral<__int128> is true or not.
>
>This patch ensures that the numeric_limits specializations for signed
>and unsigned __int128 are defined whenever __int128 is available. It
>also makes the __numeric_traits and __int_limits helpers work for
>__int128, via a new __gnu_cxx::__is_integer_nonstrict trait.
>
>libstdc++-v3/ChangeLog:
>
>	PR libstdc++/96042
>	* include/ext/numeric_traits.h (__is_integer_nonstrict): New
>	trait which is true for 128-bit integers even in strict modes.
>	(__numeric_traits_integer, __numeric_traits): Use
>	__is_integer_nonstrict instead of __is_integer.
>	* include/std/limits [__STRICT_ANSI__ && __SIZEOF_INT128__]
>	(numeric_limits<__int128>, (numeric_limits<unsigned __int128>):
>	Define.
>	* testsuite/std/ranges/iota/96042.cc: New test.

The attached patch is another change needed to support __int128 as an
integer-like type in strict mode.

Tested x86_64-linux, -m32 and -m64. Committed to trunk.

I'll backport this to gcc-10 too.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 3926 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20200819/fbefa1fd/attachment.bin>


More information about the Libstdc++ mailing list