OSDN Git Service

2011-04-18 Paolo Carlini <paolo.carlini@oracle.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / 20_util / is_nothrow_default_constructible / value.cc
1 // { dg-options "-std=gnu++0x" }
2 // 2004-12-29  Paolo Carlini  <pcarlini@suse.de>
3 //
4 // Copyright (C) 2004, 2005, 2006, 2007, 2009, 2011
5 // Free Software Foundation, Inc.
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
10 // Free Software Foundation; either version 3, or (at your option)
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
19 // with this library; see the file COPYING3.  If not see
20 // <http://www.gnu.org/licenses/>.
21
22 #include <type_traits>
23 #include <testsuite_hooks.h>
24 #include <testsuite_tr1.h>
25
26 void test01()
27 {
28   bool test __attribute__((unused)) = true;
29   using std::is_nothrow_default_constructible;
30   using namespace __gnu_test;
31
32   // Positive tests.  
33   VERIFY( (test_category<is_nothrow_default_constructible, int>(true)) );
34   VERIFY( (test_category<is_nothrow_default_constructible, float>(true)) );
35   VERIFY( (test_category<is_nothrow_default_constructible, EnumType>(true)) );
36   VERIFY( (test_category<is_nothrow_default_constructible, int*>(true)) );
37   VERIFY( (test_category<is_nothrow_default_constructible,
38            int(*)(int)>(true)) );
39   VERIFY( (test_category<is_nothrow_default_constructible,
40            int (ClassType::*)>(true)) );
41   VERIFY( (test_category<is_nothrow_default_constructible,
42            int (ClassType::*) (int)>(true)) );
43   VERIFY( (test_category<is_nothrow_default_constructible, int[2]>(true)) );
44   VERIFY( (test_category<is_nothrow_default_constructible,
45            EnumType[2][3][4]>(true)) );
46   VERIFY( (test_category<is_nothrow_default_constructible, int*[3]>(true)) );
47   VERIFY( (test_category<is_nothrow_default_constructible,
48            int (ClassType::*[2][3])>(true)) );
49   VERIFY( (test_category<is_nothrow_default_constructible, ClassType>(true)) );
50
51   VERIFY( (test_category<is_nothrow_default_constructible,
52            NoexceptDefaultClass>(true)) );
53
54   // Negative tests.
55   VERIFY( (test_category<is_nothrow_default_constructible, void>(false)) );
56   VERIFY( (test_category<is_nothrow_default_constructible, int[]>(false)) );
57   VERIFY( (test_category<is_nothrow_default_constructible,
58            float[][3]>(false)) );
59   VERIFY( (test_category<is_nothrow_default_constructible,
60            int(*[][2])(int)>(false)) );
61   VERIFY( (test_category<is_nothrow_default_constructible,
62            int (ClassType::*[][2][3]) (int)>(false)) );
63
64   VERIFY( (test_category<is_nothrow_default_constructible,
65            ThrowDefaultClass>(false)) );
66   VERIFY( (test_category<is_nothrow_default_constructible,
67            ExceptDefaultClass>(false)) );
68 }
69
70 int main()
71 {
72   test01();
73   return 0;
74 }