]>
Commit | Line | Data |
---|---|---|
285dc591 | 1 | // { dg-options "-std=gnu++11" } |
2 | // { dg-do compile } | |
3 | // | |
4 | // 2014-10-09 Ville Voutilainen <ville.voutilainen@gmail.com> | |
5 | // | |
6 | // Copyright (C) 2014 Free Software Foundation, Inc. | |
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 | |
11 | // Free Software Foundation; either version 3, or (at your option) | |
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 | |
20 | // with this library; see the file COPYING3. If not see | |
21 | // <http://www.gnu.org/licenses/>. | |
22 | ||
23 | #include <type_traits> | |
24 | #include <testsuite_tr1.h> | |
25 | ||
26 | struct HasTemplateCCtor | |
27 | { | |
28 | HasTemplateCCtor(const HasTemplateCCtor&) = default; | |
29 | template <class T> | |
30 | HasTemplateCCtor(T&&); | |
31 | }; | |
32 | ||
33 | struct MoveOnly | |
34 | { | |
35 | MoveOnly(MoveOnly&&) = default; | |
36 | }; | |
37 | ||
38 | struct MoveOnly2 | |
39 | { | |
40 | MoveOnly2(MoveOnly2&&) = delete; | |
41 | }; | |
42 | ||
43 | void test01() | |
44 | { | |
45 | using std::is_trivially_constructible; | |
46 | using namespace __gnu_test; | |
47 | ||
48 | static_assert(test_property<is_trivially_constructible, | |
49 | int>(true), ""); | |
50 | static_assert(test_property<is_trivially_constructible, | |
51 | int, int>(true), ""); | |
52 | static_assert(test_property<is_trivially_constructible, | |
53 | int, int&>(true), ""); | |
54 | static_assert(test_property<is_trivially_constructible, | |
55 | int, int&&>(true), ""); | |
56 | static_assert(test_property<is_trivially_constructible, | |
57 | int, const int&>(true), ""); | |
58 | static_assert(test_property<is_trivially_constructible, | |
59 | PolymorphicClass>(false), ""); | |
60 | static_assert(test_property<is_trivially_constructible, | |
61 | PolymorphicClass, PolymorphicClass>(false), ""); | |
62 | static_assert(test_property<is_trivially_constructible, | |
63 | PolymorphicClass, PolymorphicClass&>(false), ""); | |
64 | static_assert(test_property<is_trivially_constructible, | |
65 | PolymorphicClass, PolymorphicClass&&>(false), ""); | |
66 | static_assert(test_property<is_trivially_constructible, | |
67 | PolymorphicClass, const PolymorphicClass&>(false), ""); | |
68 | static_assert(test_property<is_trivially_constructible, | |
69 | TType>(true), ""); | |
70 | static_assert(test_property<is_trivially_constructible, | |
71 | TType, TType>(true), ""); | |
72 | static_assert(test_property<is_trivially_constructible, | |
73 | TType, TType&>(true), ""); | |
74 | static_assert(test_property<is_trivially_constructible, | |
75 | TType, TType&&>(true), ""); | |
76 | static_assert(test_property<is_trivially_constructible, | |
77 | TType, const TType&>(true), ""); | |
78 | static_assert(test_property<is_trivially_constructible, | |
79 | TType, int, int>(false), ""); | |
80 | static_assert(test_property<is_trivially_constructible, | |
81 | PODType>(true), ""); | |
82 | static_assert(test_property<is_trivially_constructible, | |
83 | PODType, PODType>(true), ""); | |
84 | static_assert(test_property<is_trivially_constructible, | |
85 | PODType, PODType&>(true), ""); | |
86 | static_assert(test_property<is_trivially_constructible, | |
87 | PODType, PODType&&>(true), ""); | |
88 | static_assert(test_property<is_trivially_constructible, | |
89 | PODType, const PODType&>(true), ""); | |
90 | static_assert(test_property<is_trivially_constructible, | |
91 | PODType, int, int>(false), ""); | |
92 | static_assert(test_property<is_trivially_constructible, | |
93 | NType>(false), ""); | |
94 | static_assert(test_property<is_trivially_constructible, | |
95 | SLType>(false), ""); | |
96 | static_assert(test_property<is_trivially_constructible, | |
97 | LType>(false), ""); | |
98 | static_assert(test_property<is_trivially_constructible, | |
99 | LType, int>(false), ""); | |
100 | static_assert(test_property<is_trivially_constructible, | |
101 | construct::DelDef>(false), ""); | |
102 | static_assert(test_property<is_trivially_constructible, | |
103 | construct::Abstract>(false), ""); | |
104 | static_assert(test_property<is_trivially_constructible, | |
105 | construct::Ellipsis>(false), ""); | |
106 | static_assert(test_property<is_trivially_constructible, | |
107 | construct::DelEllipsis>(false), ""); | |
108 | static_assert(test_property<is_trivially_constructible, | |
109 | construct::Any>(false), ""); | |
110 | static_assert(test_property<is_trivially_constructible, | |
111 | construct::DelCopy>(false), ""); | |
112 | static_assert(test_property<is_trivially_constructible, | |
113 | construct::DelCopy, const construct::DelCopy&>(false), ""); | |
114 | static_assert(test_property<is_trivially_constructible, | |
115 | construct::DelDtor>(false), ""); | |
116 | static_assert(test_property<is_trivially_constructible, | |
117 | construct::Nontrivial>(false), ""); | |
118 | static_assert(test_property<is_trivially_constructible, | |
119 | construct::UnusualCopy>(false), ""); | |
120 | static_assert(test_property<is_trivially_constructible, | |
121 | CopyConsOnlyType>(false), ""); | |
122 | static_assert(test_property<is_trivially_constructible, | |
123 | CopyConsOnlyType, CopyConsOnlyType>(false), ""); | |
124 | static_assert(test_property<is_trivially_constructible, | |
125 | CopyConsOnlyType, CopyConsOnlyType&>(true), ""); | |
126 | static_assert(test_property<is_trivially_constructible, | |
127 | CopyConsOnlyType, CopyConsOnlyType&&>(false), ""); | |
128 | static_assert(test_property<is_trivially_constructible, | |
129 | CopyConsOnlyType, const CopyConsOnlyType&>(true), ""); | |
130 | static_assert(test_property<is_trivially_constructible, | |
131 | MoveConsOnlyType>(false), ""); | |
132 | static_assert(test_property<is_trivially_constructible, | |
133 | MoveConsOnlyType, MoveConsOnlyType>(true), ""); | |
134 | static_assert(test_property<is_trivially_constructible, | |
135 | MoveConsOnlyType, MoveConsOnlyType&>(false), ""); | |
136 | static_assert(test_property<is_trivially_constructible, | |
137 | MoveConsOnlyType, MoveConsOnlyType&&>(true), ""); | |
138 | static_assert(test_property<is_trivially_constructible, | |
139 | MoveConsOnlyType, const MoveConsOnlyType&>(false), ""); | |
140 | static_assert(test_property<is_trivially_constructible, | |
141 | ClassType, DerivedType>(true), ""); | |
142 | static_assert(test_property<is_trivially_constructible, | |
143 | ClassType, DerivedType&>(true), ""); | |
144 | static_assert(test_property<is_trivially_constructible, | |
145 | ClassType, DerivedType&&>(true), ""); | |
146 | static_assert(test_property<is_trivially_constructible, | |
147 | ClassType, const DerivedType&>(true), ""); | |
148 | static_assert(test_property<is_trivially_constructible, | |
149 | HasTemplateCCtor>(false), ""); | |
150 | static_assert(test_property<is_trivially_constructible, | |
151 | HasTemplateCCtor, HasTemplateCCtor>(false), ""); | |
152 | static_assert(test_property<is_trivially_constructible, | |
153 | HasTemplateCCtor, const HasTemplateCCtor&>(true), ""); | |
154 | static_assert(test_property<is_trivially_constructible, | |
155 | MoveOnly>(false), ""); | |
156 | static_assert(test_property<is_trivially_constructible, | |
157 | MoveOnly, MoveOnly>(true), ""); | |
158 | static_assert(test_property<is_trivially_constructible, | |
159 | MoveOnly, MoveOnly&>(false), ""); | |
160 | static_assert(test_property<is_trivially_constructible, | |
161 | MoveOnly, MoveOnly&&>(true), ""); | |
162 | static_assert(test_property<is_trivially_constructible, | |
163 | MoveOnly, const MoveOnly&>(false), ""); | |
164 | static_assert(test_property<is_trivially_constructible, | |
165 | MoveOnly2>(false), ""); | |
166 | ||
167 | ||
168 | } |