OSDN Git Service

2011-04-18 Paolo Carlini <paolo.carlini@oracle.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / 20_util / is_nothrow_constructible / value.cc
1 // { dg-options "-std=gnu++0x" }
2
3 // 2010-06-09  Paolo Carlini  <paolo.carlini@oracle.com>
4
5 // Copyright (C) 2010, 2011 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_constructible;
30   using namespace __gnu_test;
31
32   // Positive tests.
33   VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
34            double&>(true)) );
35   VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
36            int&>(true)) );
37   VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
38            double&, int&, double&>(true)) );
39   VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
40            double&>(true)) );
41   VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
42            int&>(true)) );
43   VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
44            double&, int&, double&>(true)) );
45
46   VERIFY( (test_property<is_nothrow_constructible, int[1]>(true)) );
47
48   // Negative tests.
49   VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
50            void*>(false)) );
51   VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass>
52            (false)) );
53   VERIFY( (test_property<is_nothrow_constructible, NoexceptExplicitClass,
54            int, double>(false)) );
55   VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
56            void*>(false)) );
57   VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass>
58            (false)) );
59   VERIFY( (test_property<is_nothrow_constructible, NothrowExplicitClass,
60            int, double>(false)) );
61
62   VERIFY( (test_property<is_nothrow_constructible, ExceptExplicitClass,
63            double&>(false)) );
64   VERIFY( (test_property<is_nothrow_constructible, ExceptExplicitClass,
65            int&>(false)) );
66   VERIFY( (test_property<is_nothrow_constructible, ExceptExplicitClass,
67            double&, int&, double&>(false)) );
68   VERIFY( (test_property<is_nothrow_constructible, ThrowExplicitClass,
69            double&>(false)) );
70   VERIFY( (test_property<is_nothrow_constructible, ThrowExplicitClass,
71            int&>(false)) );
72   VERIFY( (test_property<is_nothrow_constructible, ThrowExplicitClass,
73            double&, int&, double&>(false)) );
74
75   VERIFY( (test_property<is_nothrow_constructible, int[]>(false)) );
76 }
77
78 int main()
79 {
80   test01();
81   return 0;
82 }