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