]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix test that fails for targets without __int128 [PR 96042]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 13 Nov 2020 13:04:10 +0000 (13:04 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 13 Nov 2020 13:11:06 +0000 (13:11 +0000)
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<long long, long long>
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.

libstdc++-v3/testsuite/std/ranges/iota/96042.cc

index 911663bc41396d1c42b3cf4f29176ccdff3c3bb0..3ee0639fcd6dbaec1ef07ea9cb928ba7547129ce 100644 (file)
@@ -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<V>;
   // Ensure that numeric_limits is correctly specialized for the type.
   using L = std::numeric_limits<D>;
@@ -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<long long>::digits );
+#endif
   static_assert( L::digits10 == static_cast<int>(L::digits * 0.30103) );
   static_assert( L::min() == (D(1) << L::digits) );
   static_assert( L::max() == ~L::min() );