https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121150

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Jonathan Wakely from comment #1)
> There is no long anywhere here. The problem is that size_t is 32 bits, and
> using an INT64 suffix won't change that: the value will still be too large
> for size_t.
> 
> I'll fix it by using a different value for __SIZE_WIDTH__ == 32

I think this

diff --git a/libstdc++-v3/testsuite/20_util/hash/int128.cc
b/libstdc++-v3/testsuite/20_util/hash/int128.cc
index 7c3a1baa0ec..9677eefbf2a 100644
--- a/libstdc++-v3/testsuite/20_util/hash/int128.cc
+++ b/libstdc++-v3/testsuite/20_util/hash/int128.cc
@@ -1,6 +1,7 @@
 // { dg-do run { target c++11 } }
 // { dg-add-options strict_std }

+#include <stdint.h>
 #include <functional>
 #include <testsuite_hooks.h>

@@ -8,7 +9,7 @@ int main()
 {
 #ifdef __SIZEOF_INT128__
   std::hash<__int128> h;
-  __int128 i = (__int128)0x123456789;
+  __int128 i = (__int128)INT64_C(0x123456789);
   VERIFY( h(i) == i );
   VERIFY( h(-i) == (std::size_t)-i );
   VERIFY( h(~i) == (std::size_t)~i );

should work.

Reply via email to