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