[libcxx-commits] [PATCH] D57778: std::abs should not return double (2735)
Zoe Carver via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 20 09:41:04 PDT 2019
zoecarver updated this revision to Diff 216185.
zoecarver added a comment.
- fix on systems where char is unsigned.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57778/new/
https://reviews.llvm.org/D57778
Files:
libcxx/test/std/numerics/c.math/abs.pass.cpp
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
@@ -41,8 +41,14 @@
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>();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57778.216185.patch
Type: text/x-patch
Size: 846 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190820/48b952ea/attachment.bin>
More information about the libcxx-commits
mailing list