Home | History | Annotate | Download | only in meta.trans.sign
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // type_traits
     11 
     12 // make_signed
     13 
     14 #include <type_traits>
     15 
     16 enum Enum {zero, one_};
     17 
     18 enum BigEnum
     19 {
     20     bzero,
     21     big = 0xFFFFFFFFFFFFFFFFULL
     22 };
     23 
     24 int main()
     25 {
     26     static_assert((std::is_same<std::make_signed<signed char>::type, signed char>::value), "");
     27     static_assert((std::is_same<std::make_signed<unsigned char>::type, signed char>::value), "");
     28     static_assert((std::is_same<std::make_signed<char>::type, signed char>::value), "");
     29     static_assert((std::is_same<std::make_signed<short>::type, signed short>::value), "");
     30     static_assert((std::is_same<std::make_signed<unsigned short>::type, signed short>::value), "");
     31     static_assert((std::is_same<std::make_signed<int>::type, signed int>::value), "");
     32     static_assert((std::is_same<std::make_signed<unsigned int>::type, signed int>::value), "");
     33     static_assert((std::is_same<std::make_signed<long>::type, signed long>::value), "");
     34     static_assert((std::is_same<std::make_signed<unsigned long>::type, long>::value), "");
     35     static_assert((std::is_same<std::make_signed<long long>::type, signed long long>::value), "");
     36     static_assert((std::is_same<std::make_signed<unsigned long long>::type, signed long long>::value), "");
     37     static_assert((std::is_same<std::make_signed<wchar_t>::type, int>::value), "");
     38     static_assert((std::is_same<std::make_signed<const wchar_t>::type, const int>::value), "");
     39     static_assert((std::is_same<std::make_signed<const Enum>::type, const int>::value), "");
     40     static_assert((std::is_same<std::make_signed<BigEnum>::type,
     41                    std::conditional<sizeof(long) == 4, long long, long>::type>::value), "");
     42 }
     43