From: Jonathan Wakely Date: Fri, 13 Nov 2020 13:04:10 +0000 (+0000) Subject: libstdc++: Fix test that fails for targets without __int128 [PR 96042] X-Git-Tag: releases/gcc-10.3.0~643 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12042aeb9336f20b9225b2e5139e5f6c9bde7642;p=thirdparty%2Fgcc.git libstdc++: Fix test that fails for targets without __int128 [PR 96042] When backporting this test (and the changes it depends on) I forgot that the __max_diff_type and __max_size_type classes are only present on trunk, not the gcc-10 branch. That using iota_view oonly works correctly when __int128 is available, so the test fails on 32-bit targets. This just skips the failing check. PR libstdc++/96042 * testsuite/std/ranges/iota/96042.cc: Only assert that the difference type is wider than long long if __int128 is supported. --- diff --git a/libstdc++-v3/testsuite/std/ranges/iota/96042.cc b/libstdc++-v3/testsuite/std/ranges/iota/96042.cc index 911663bc4139..3ee0639fcd6d 100644 --- a/libstdc++-v3/testsuite/std/ranges/iota/96042.cc +++ b/libstdc++-v3/testsuite/std/ranges/iota/96042.cc @@ -28,7 +28,8 @@ test01() // In strict -std=c++20 mode there is no integer wider than long long, // so V's difference type is an integer-class type, [iterator.concept.winc]. - // In practice this is either __int128 or __detail::__max_diff_type. + // In practice we use __int128 for this where that type is available, + // and cannot meet the requirement otherwise (this is fixed in GCC 11). using D = std::ranges::range_difference_t; // Ensure that numeric_limits is correctly specialized for the type. using L = std::numeric_limits; @@ -36,7 +37,9 @@ test01() static_assert( L::is_signed ); static_assert( L::is_integer ); static_assert( L::is_exact ); +#ifdef __SIZEOF_INT128__ static_assert( L::digits > std::numeric_limits::digits ); +#endif static_assert( L::digits10 == static_cast(L::digits * 0.30103) ); static_assert( L::min() == (D(1) << L::digits) ); static_assert( L::max() == ~L::min() );