]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix std::format test for Solaris [PR113450]
authorJonathan Wakely <jwakely@redhat.com>
Wed, 17 Jan 2024 21:40:25 +0000 (21:40 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 18 Jan 2024 12:43:31 +0000 (12:43 +0000)
When int8_t is a typedef for char (rather than signed char) this test
fails because it tries to format a char, which is treated differently
from formatting other integral types (including signed char).

Use signed char explicitly so the result doesn't depend on the
non-portable definition of int8_t.

libstdc++-v3/ChangeLog:

PR libstdc++/113450
* testsuite/std/format/functions/format.cc: Use signed char
instead of int8_t.

libstdc++-v3/testsuite/std/format/functions/format.cc

index 63702edbd42e0473db4b741204131e748efac9ab..30c5fc222377331c655770165df59dfcb28e4428 100644 (file)
@@ -365,7 +365,7 @@ test_minmax()
     s = std::format("{:b}" , std::numeric_limits<U>::max());
     VERIFY( s == '1' + ones );
   };
-  check(std::int8_t(0));
+  check((signed char)(0)); // int8_t is char on Solaris, see PR 113450
   check(std::int16_t(0));
   check(std::int32_t(0));
   check(std::int64_t(0));