]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/is_unsigned/value.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / is_unsigned / value.cc
CommitLineData
52066eae 1// { dg-do compile { target c++11 } }
44916fe1 2
e133ace8
PC
3// 2005-01-24 Paolo Carlini <pcarlini@suse.de>
4//
a5544970 5// Copyright (C) 2005-2019 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
25void 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), "");
e133ace8 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), "");
e133ace8 35#ifdef _GLIBCXX_USE_WCHAR_T
44916fe1
PC
36 static_assert(test_category<is_unsigned, wchar_t>
37 (wchar_t(-1) > wchar_t(0)), "");
e133ace8 38#endif
44916fe1
PC
39 static_assert(test_category<is_unsigned, short>(false), "");
40 static_assert(test_category<is_unsigned, unsigned short>(true), "");
41 static_assert(test_category<is_unsigned, int>(false), "");
42 static_assert(test_category<is_unsigned, unsigned int>(true), "");
43 static_assert(test_category<is_unsigned, long>(false), "");
44 static_assert(test_category<is_unsigned, unsigned long>(true), "");
45 static_assert(test_category<is_unsigned, long long>(false), "");
46 static_assert(test_category<is_unsigned, unsigned long long>(true), "");
e133ace8 47
44916fe1
PC
48 static_assert(test_category<is_unsigned, float>(false), "");
49 static_assert(test_category<is_unsigned, double>(false), "");
50 static_assert(test_category<is_unsigned, long double>(false), "");
e133ace8 51
2f297149 52#ifndef __STRICT_ANSI__
6d585f01
PC
53 // GNU Extensions.
54#ifdef _GLIBCXX_USE_INT128
44916fe1
PC
55 static_assert(test_category<is_unsigned, unsigned __int128>(true), "");
56 static_assert(test_category<is_unsigned, __int128>(false), "");
6d585f01
PC
57#endif
58
59#ifdef _GLIBCXX_USE_FLOAT128
44916fe1 60 static_assert(test_category<is_unsigned, __float128>(false), "");
2f297149 61#endif
6d585f01
PC
62#endif
63
e133ace8 64 // Sanity check.
44916fe1 65 static_assert(test_category<is_unsigned, ClassType>(false), "");
e133ace8 66}