Skip to content

Commit 86d560f

Browse files
committed
[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. llvm-svn: 369413
1 parent 2e897a9 commit 86d560f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

libcxx/test/std/numerics/c.math/abs.pass.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,14 @@ void test_big()
4141

4242
int main(int, char**)
4343
{
44+
// On some systems char is unsigned.
45+
// If that is the case, we should just test signed char twice.
46+
typedef typename std::conditional<
47+
std::is_signed<char>::value, char, signed char
48+
>::type SignedChar;
49+
4450
test_abs<short int, typename correct_size_int<short int>::type>();
45-
test_abs<char, typename correct_size_int<char>::type>();
51+
test_abs<SignedChar, typename correct_size_int<SignedChar>::type>();
4652
test_abs<signed char, typename correct_size_int<signed char>::type>();
4753

4854
test_abs<int, typename correct_size_int<int>::type>();

0 commit comments

Comments
 (0)