is_unsigned.pass.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
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// is_unsigned
13
14#include <type_traits>
15
16template <class T>
17void test_is_unsigned()
18{
19    static_assert( std::is_unsigned<T>::value, "");
20    static_assert( std::is_unsigned<const T>::value, "");
21    static_assert( std::is_unsigned<volatile T>::value, "");
22    static_assert( std::is_unsigned<const volatile T>::value, "");
23}
24
25template <class T>
26void test_is_not_unsigned()
27{
28    static_assert(!std::is_unsigned<T>::value, "");
29    static_assert(!std::is_unsigned<const T>::value, "");
30    static_assert(!std::is_unsigned<volatile T>::value, "");
31    static_assert(!std::is_unsigned<const volatile T>::value, "");
32}
33
34class Class
35{
36public:
37    ~Class();
38};
39
40int main()
41{
42    test_is_not_unsigned<void>();
43    test_is_not_unsigned<int&>();
44    test_is_not_unsigned<Class>();
45    test_is_not_unsigned<int*>();
46    test_is_not_unsigned<const int*>();
47    test_is_not_unsigned<char[3]>();
48    test_is_not_unsigned<char[3]>();
49    test_is_not_unsigned<int>();
50    test_is_not_unsigned<double>();
51
52    test_is_unsigned<bool>();
53    test_is_unsigned<unsigned>();
54}
55