summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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