summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Cain <bcain@quicinc.com>2019-05-13 15:41:18 +0000
committerBrian Cain <bcain@quicinc.com>2019-05-13 15:41:18 +0000
commit9423ba8121836a0da8e75d1ad72441a5f3fcf327 (patch)
treedf36597b2118c2f9a32d756ac7879235b775008a
parente5248e6b41e05f8384591baa4d2c8ccf35708a3c (diff)
downloadbcm5719-llvm-9423ba8121836a0da8e75d1ad72441a5f3fcf327.tar.gz
bcm5719-llvm-9423ba8121836a0da8e75d1ad72441a5f3fcf327.zip
[libcxx] teach type_traits test about long uint32_t
Patch by Ben Craig. llvm-svn: 360590
-rw-r--r--libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp b/libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp
index 08b6b5e8b2a..535268560a9 100644
--- a/libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp
+++ b/libcxx/test/libcxx/type_traits/convert_to_integral.pass.cpp
@@ -87,7 +87,14 @@ int main(int, char**)
check_integral_types<unsigned char, int>();
check_integral_types<wchar_t, decltype(((wchar_t)1) + 1)>();
check_integral_types<char16_t, int>();
- check_integral_types<char32_t, uint32_t>();
+ // On some platforms, unsigned int and long are the same size. These
+ // platforms have a choice of making uint32_t an int or a long. However
+ // char32_t must promote to an unsigned int on these platforms [conv.prom].
+ // Use the following logic to make the test work on such platforms.
+ // (sizeof(uint32_t) == sizeof(unsigned int)) ? unsigned int : uint32_t;
+ typedef std::conditional<sizeof(uint32_t) == sizeof(unsigned int),
+ unsigned int, uint32_t>::type char_integral;
+ check_integral_types<char32_t, char_integral>();
check_integral_types<short, int>();
check_integral_types<unsigned short, int>();
check_integral_types<int, int>();
OpenPOWER on IntegriCloud