]>
Commit | Line | Data |
---|---|---|
52066eae | 1 | // { dg-do compile { target c++11 } } |
44916fe1 | 2 | |
e133ace8 PC |
3 | // 2005-01-24 Paolo Carlini <pcarlini@suse.de> |
4 | // | |
7adcbafe | 5 | // Copyright (C) 2005-2022 Free Software Foundation, Inc. |
e133ace8 PC |
6 | // |
7 | // This file is part of the GNU ISO C++ Library. This library is free | |
8 | // software; you can redistribute it and/or modify it under the | |
9 | // terms of the GNU General Public License as published by the | |
748086b7 | 10 | // Free Software Foundation; either version 3, or (at your option) |
e133ace8 PC |
11 | // any later version. |
12 | // | |
13 | // This library is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | // | |
18 | // You should have received a copy of the GNU General Public License along | |
748086b7 JJ |
19 | // with this library; see the file COPYING3. If not see |
20 | // <http://www.gnu.org/licenses/>. | |
e133ace8 PC |
21 | |
22 | #include <type_traits> | |
e133ace8 PC |
23 | #include <testsuite_tr1.h> |
24 | ||
25 | void test01() | |
26 | { | |
e133ace8 PC |
27 | using std::is_unsigned; |
28 | using namespace __gnu_test; | |
44916fe1 PC |
29 | |
30 | static_assert(test_category<is_unsigned, void>(false), ""); | |
fec283b6 | 31 | |
44916fe1 PC |
32 | static_assert(test_category<is_unsigned, char>(char(-1) > char(0)), ""); |
33 | static_assert(test_category<is_unsigned, signed char>(false), ""); | |
34 | static_assert(test_category<is_unsigned, unsigned char>(true), ""); | |
44916fe1 PC |
35 | static_assert(test_category<is_unsigned, wchar_t> |
36 | (wchar_t(-1) > wchar_t(0)), ""); | |
44916fe1 PC |
37 | static_assert(test_category<is_unsigned, short>(false), ""); |
38 | static_assert(test_category<is_unsigned, unsigned short>(true), ""); | |
39 | static_assert(test_category<is_unsigned, int>(false), ""); | |
40 | static_assert(test_category<is_unsigned, unsigned int>(true), ""); | |
41 | static_assert(test_category<is_unsigned, long>(false), ""); | |
42 | static_assert(test_category<is_unsigned, unsigned long>(true), ""); | |
43 | static_assert(test_category<is_unsigned, long long>(false), ""); | |
44 | static_assert(test_category<is_unsigned, unsigned long long>(true), ""); | |
e133ace8 | 45 | |
44916fe1 PC |
46 | static_assert(test_category<is_unsigned, float>(false), ""); |
47 | static_assert(test_category<is_unsigned, double>(false), ""); | |
48 | static_assert(test_category<is_unsigned, long double>(false), ""); | |
e133ace8 | 49 | |
2f297149 | 50 | #ifndef __STRICT_ANSI__ |
6d585f01 | 51 | // GNU Extensions. |
29a9de9b | 52 | #ifdef __SIZEOF_INT128__ |
44916fe1 PC |
53 | static_assert(test_category<is_unsigned, unsigned __int128>(true), ""); |
54 | static_assert(test_category<is_unsigned, __int128>(false), ""); | |
6d585f01 PC |
55 | #endif |
56 | ||
57 | #ifdef _GLIBCXX_USE_FLOAT128 | |
44916fe1 | 58 | static_assert(test_category<is_unsigned, __float128>(false), ""); |
2f297149 | 59 | #endif |
6d585f01 PC |
60 | #endif |
61 | ||
e133ace8 | 62 | // Sanity check. |
44916fe1 | 63 | static_assert(test_category<is_unsigned, ClassType>(false), ""); |
e133ace8 | 64 | } |