[libcxx-commits] [libcxx] r369413 - [libc++] fix test for unsigned char

Zoe Carver via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 20 10:09:00 PDT 2019

Author: zoecarver
Date: Tue Aug 20 10:09:00 2019
New Revision: 369413

URL: http://llvm.org/viewvc/llvm-project?rev=369413&view=rev
[libc++] fix test for unsigned char

On some systems char is unsigned.
If that is the case, we will now
test signed char twice in std::abs.
NFC. Fixes the build bots.


Modified: libcxx/trunk/test/std/numerics/c.math/abs.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/abs.pass.cpp?rev=369413&r1=369412&r2=369413&view=diff
--- libcxx/trunk/test/std/numerics/c.math/abs.pass.cpp (original)
+++ libcxx/trunk/test/std/numerics/c.math/abs.pass.cpp Tue Aug 20 10:09:00 2019
@@ -41,8 +41,14 @@ void test_big()
 int main(int, char**)
+    // On some systems char is unsigned.
+    // If that is the case, we should just test signed char twice.
+    typedef typename std::conditional<
+        std::is_signed<char>::value, char, signed char
+    >::type SignedChar;
     test_abs<short int, typename correct_size_int<short int>::type>();
-    test_abs<char, typename correct_size_int<char>::type>();
+    test_abs<SignedChar, typename correct_size_int<SignedChar>::type>();
     test_abs<signed char, typename correct_size_int<signed char>::type>();
     test_abs<int, typename correct_size_int<int>::type>();

More information about the libcxx-commits mailing list