Skip to content

Commit

Permalink
[libc++] fix test for unsigned char
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zoecarver committed Aug 20, 2019
1 parent 2e897a9 commit 86d560f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libcxx/test/std/numerics/c.math/abs.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand Down

0 comments on commit 86d560f

Please sign in to comment.