cxx/test/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
Howard Hinnant bc8d3f97eb libcxx initial import
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@103490 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 19:42:16 +00:00

1 line
1.9 KiB
C++

//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// make_signed
#include <type_traits>
enum Enum {zero, one_};
enum BigEnum
{
bzero,
big = 0xFFFFFFFFFFFFFFFFULL
};
int main()
{
static_assert((std::is_same<std::make_signed<signed char>::type, signed char>::value), "");
static_assert((std::is_same<std::make_signed<unsigned char>::type, signed char>::value), "");
static_assert((std::is_same<std::make_signed<char>::type, signed char>::value), "");
static_assert((std::is_same<std::make_signed<short>::type, signed short>::value), "");
static_assert((std::is_same<std::make_signed<unsigned short>::type, signed short>::value), "");
static_assert((std::is_same<std::make_signed<int>::type, signed int>::value), "");
static_assert((std::is_same<std::make_signed<unsigned int>::type, signed int>::value), "");
static_assert((std::is_same<std::make_signed<long>::type, signed long>::value), "");
static_assert((std::is_same<std::make_signed<unsigned long>::type, long>::value), "");
static_assert((std::is_same<std::make_signed<long long>::type, signed long long>::value), "");
static_assert((std::is_same<std::make_signed<unsigned long long>::type, signed long long>::value), "");
static_assert((std::is_same<std::make_signed<wchar_t>::type, int>::value), "");
static_assert((std::is_same<std::make_signed<const wchar_t>::type, const int>::value), "");
static_assert((std::is_same<std::make_signed<const Enum>::type, const int>::value), "");
static_assert((std::is_same<std::make_signed<BigEnum>::type,
std::conditional<sizeof(long) == 4, long long, long>::type>::value), "");
}