1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
14 #include <type_traits>
16 enum Enum {zero, one_};
21 big = 0xFFFFFFFFFFFFFFFFULL
24 template <class T, class U>
25 void test_make_signed()
27 static_assert((std::is_same<typename std::make_signed<T>::type, U>::value), "");
28 #if _LIBCPP_STD_VER > 11
29 static_assert((std::is_same<std::make_signed_t<T>, U>::value), "");
35 test_make_signed< signed char, signed char >();
36 test_make_signed< unsigned char, signed char >();
37 test_make_signed< char, signed char >();
38 test_make_signed< short, signed short >();
39 test_make_signed< unsigned short, signed short >();
40 test_make_signed< int, signed int >();
41 test_make_signed< unsigned int, signed int >();
42 test_make_signed< long, signed long >();
43 test_make_signed< unsigned long, long >();
44 test_make_signed< long long, signed long long >();
45 test_make_signed< unsigned long long, signed long long >();
46 test_make_signed< wchar_t, std::conditional<sizeof(wchar_t) == 4, int, short>::type >();
47 test_make_signed< const wchar_t, std::conditional<sizeof(wchar_t) == 4, const int, const short>::type >();
48 test_make_signed< const Enum, const int >();
49 test_make_signed< BigEnum, std::conditional<sizeof(long) == 4, long long, long>::type >();