[libcxx] teach type_traits test about long uint32_t

Patch by Ben Craig.




git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@360590 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/libcxx/type_traits/convert_to_integral.pass.cpp b/test/libcxx/type_traits/convert_to_integral.pass.cpp
index 08b6b5e..5352685 100644
--- a/test/libcxx/type_traits/convert_to_integral.pass.cpp
+++ b/test/libcxx/type_traits/convert_to_integral.pass.cpp
@@ -87,7 +87,14 @@
   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>();