Index: libcxx/test/std/numerics/c.math/abs.pass.cpp =================================================================== --- libcxx/test/std/numerics/c.math/abs.pass.cpp +++ libcxx/test/std/numerics/c.math/abs.pass.cpp @@ -16,7 +16,7 @@ template struct correct_size_int { - typedef typename std::conditional::type type; + typedef typename std::conditional::type type; }; template @@ -39,6 +39,9 @@ assert(std::abs(negative_big_value) == big_value); // make sure it doesnt get casted to a smaller type } +// The following is helpful to keep in mind: +// 1byte == char <= short <= int <= long <= long long + int main(int, char**) { // On some systems char is unsigned. @@ -47,14 +50,18 @@ std::is_signed::value, char, signed char >::type SignedChar; - test_abs::type>(); - test_abs::type>(); - test_abs::type>(); + // All types less than or equal to and not greater than int are promoted to int. + test_abs(); + test_abs(); + test_abs(); - test_abs::type>(); - test_abs::type>(); - test_abs::type>(); + // These three calls have specific overloads: + test_abs(); + test_abs(); + test_abs(); + // Here there is no guarantee that int is larger than int8_t so we + // use a helper type trait to conditional test against int. test_abs::type>(); test_abs::type>(); test_abs::type>();