Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / libstdc++-v3 / testsuite / 20_util / is_default_constructible / value.cc
1 // { dg-options "-std=gnu++0x" }
2 // { dg-do compile }
3
4 // Copyright (C) 2011-2013 Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library.  This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3.  If not see
19 // <http://www.gnu.org/licenses/>.
20
21 #include <type_traits>
22 #include <initializer_list>
23 #include <testsuite_tr1.h>
24
25 using namespace __gnu_test::construct;
26
27 static_assert(std::is_default_constructible<int>::value, "Error");
28 static_assert(std::is_default_constructible<int const>::value, "Error");
29 static_assert(std::is_default_constructible<int const volatile>::value,
30               "Error");
31 static_assert(std::is_default_constructible<int*>::value, "Error");
32 static_assert(std::is_default_constructible<void*>::value, "Error");
33 static_assert(std::is_default_constructible<void* const>::value, "Error");
34 static_assert(std::is_default_constructible<int B::*>::value, "Error");
35 static_assert(std::is_default_constructible<void(*)()>::value, "Error");
36 static_assert(std::is_default_constructible<std::nullptr_t>::value, "Error");
37 static_assert(std::is_default_constructible<std::nullptr_t const>::value,
38               "Error");
39 static_assert(std::is_default_constructible<Empty>::value, "Error");
40 static_assert(std::is_default_constructible<Empty const>::value, "Error");
41 static_assert(std::is_default_constructible<FromArgs<>>::value, "Error");
42 static_assert(std::is_default_constructible<FromArgs<> const>::value, "Error");
43 static_assert(std::is_default_constructible<nAny>::value, "Error");
44 static_assert(std::is_default_constructible<nAny const>::value, "Error");
45 static_assert(std::is_default_constructible<Ellipsis>::value, "Error");
46 static_assert(std::is_default_constructible<Ellipsis const>::value, "Error");
47 static_assert(std::is_default_constructible<U>::value, "Error");
48 static_assert(std::is_default_constructible<U const>::value, "Error");
49 static_assert(std::is_default_constructible<E>::value, "Error");
50 static_assert(std::is_default_constructible<E const>::value, "Error");
51 static_assert(std::is_default_constructible<SE>::value, "Error");
52 static_assert(std::is_default_constructible<SE const>::value, "Error");
53 static_assert(std::is_default_constructible<OpE>::value, "Error");
54 static_assert(std::is_default_constructible<OpE const>::value, "Error");
55 static_assert(std::is_default_constructible<OpSE>::value, "Error");
56 static_assert(std::is_default_constructible<OpSE const>::value, "Error");
57 static_assert(std::is_default_constructible<int[1]>::value, "Error");
58 static_assert(std::is_default_constructible<const int[1]>::value, "Error");
59 static_assert(std::is_default_constructible<int[1][2]>::value, "Error");
60 static_assert(std::is_default_constructible<const int[1][2]>::value, "Error");
61 static_assert(std::is_default_constructible<FromArgs<>[1]>::value, "Error");
62 static_assert(std::is_default_constructible<const FromArgs<>[1]>::value,
63               "Error");
64 static_assert(std::is_default_constructible<U[1]>::value, "Error");
65 static_assert(std::is_default_constructible<const U[1]>::value, "Error");
66 static_assert(std::is_default_constructible<Empty[1]>::value, "Error");
67 static_assert(std::is_default_constructible<const Empty[1]>::value, "Error");
68 static_assert(std::is_default_constructible<Ellipsis[1]>::value, "Error");
69 static_assert(std::is_default_constructible<const Ellipsis[1]>::value, "Error");
70 static_assert(std::is_default_constructible<std::nullptr_t[1]>::value, "Error");
71 static_assert(std::is_default_constructible<const std::nullptr_t[1]>::value,
72               "Error");
73 static_assert(std::is_default_constructible<nAny[1]>::value, "Error");
74 static_assert(std::is_default_constructible<const nAny[1]>::value, "Error");
75 static_assert(std::is_default_constructible<E[1]>::value, "Error");
76 static_assert(std::is_default_constructible<const E[1]>::value, "Error");
77 static_assert(std::is_default_constructible<SE[1]>::value, "Error");
78 static_assert(std::is_default_constructible<const SE[1]>::value, "Error");
79 static_assert(std::is_default_constructible<OpE[1]>::value, "Error");
80 static_assert(std::is_default_constructible<const OpE[1]>::value, "Error");
81 static_assert(std::is_default_constructible<OpSE[1]>::value, "Error");
82 static_assert(std::is_default_constructible<const OpSE[1]>::value, "Error");
83 static_assert(std::is_default_constructible<int*[1]>::value, "Error");
84 static_assert(std::is_default_constructible<int* const[1]>::value, "Error");
85 static_assert(std::is_default_constructible<int B::*[1]>::value, "Error");
86 static_assert(std::is_default_constructible<int B::* const[1]>::value, "Error");
87 static_assert(std::is_default_constructible<std::initializer_list<int>>::value,
88               "Error");
89 static_assert(std::is_default_constructible<const
90               std::initializer_list<int>>::value, "Error");
91 static_assert(std::is_default_constructible<
92               std::initializer_list<int>[1]>::value, "Error");
93 static_assert(std::is_default_constructible<const
94               std::initializer_list<int>[1]>::value, "Error");
95
96 static_assert(std::is_default_constructible
97               <__gnu_test::NoexceptDefaultClass>::value, "Error");
98 static_assert(std::is_default_constructible
99               <__gnu_test::ThrowDefaultClass>::value, "Error");
100 static_assert(std::is_default_constructible
101               <__gnu_test::ExceptDefaultClass>::value, "Error");
102
103 static_assert(!std::is_default_constructible<void>::value, "Error");
104 static_assert(!std::is_default_constructible<const void>::value, "Error");
105 static_assert(!std::is_default_constructible<Abstract>::value, "Error");
106 static_assert(!std::is_default_constructible<const Abstract>::value, "Error");
107 static_assert(!std::is_default_constructible<Any>::value, "Error");
108 static_assert(!std::is_default_constructible<const Any>::value, "Error");
109 static_assert(!std::is_default_constructible<FromArgs<int>>::value, "Error");
110 static_assert(!std::is_default_constructible<const FromArgs<int>>::value,
111               "Error");
112 static_assert(!std::is_default_constructible<int&>::value, "Error");
113 static_assert(!std::is_default_constructible<int&&>::value, "Error");
114 static_assert(!std::is_default_constructible<void()>::value, "Error");
115 static_assert(!std::is_default_constructible<void() const volatile>::value,
116               "Error");
117 static_assert(!std::is_default_constructible<void(&)()>::value, "Error");
118 static_assert(!std::is_default_constructible<int(&)[1]>::value, "Error");
119 static_assert(!std::is_default_constructible<int(&)[]>::value, "Error");
120 static_assert(!std::is_default_constructible<int[]>::value, "Error");
121 static_assert(!std::is_default_constructible<const int[]>::value, "Error");
122 static_assert(!std::is_default_constructible<int[][1][2]>::value, "Error");
123 static_assert(!std::is_default_constructible<const int[][1][2]>::value,
124               "Error");
125 static_assert(!std::is_default_constructible<Any[1]>::value, "Error");
126 static_assert(!std::is_default_constructible<const Any[1]>::value, "Error");
127 static_assert(!std::is_default_constructible<FromArgs<int>[1]>::value, "Error");
128 static_assert(!std::is_default_constructible<const FromArgs<int>[1]>::value,
129               "Error");
130 static_assert(!std::is_default_constructible<
131               FromArgs<std::initializer_list<int>>>::value, "Error");
132 static_assert(!std::is_default_constructible<const
133               FromArgs<std::initializer_list<int>>>::value, "Error");
134 static_assert(!std::is_default_constructible<const
135               FromArgs<const std::initializer_list<int>>>::value, "Error");
136 static_assert(!std::is_default_constructible<DelDef>::value, "Error");
137 static_assert(!std::is_default_constructible<const DelDef>::value, "Error");
138 static_assert(!std::is_default_constructible<DelCopy>::value, "Error");
139 static_assert(!std::is_default_constructible<const DelCopy>::value, "Error");
140 static_assert(!std::is_default_constructible<DelDtor>::value, "Error");
141 static_assert(!std::is_default_constructible<const DelDtor>::value, "Error");