1 // { dg-options "-std=gnu++11" }
4 // 2014-10-09 Ville Voutilainen <ville.voutilainen@gmail.com>
6 // Copyright (C) 2014-2016 Free Software Foundation, Inc.
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)
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.
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/>.
23 #include <type_traits>
24 #include <testsuite_tr1.h>
26 struct HasTemplateCCtor
28 HasTemplateCCtor(const HasTemplateCCtor
&) = default;
30 HasTemplateCCtor(T
&&);
35 MoveOnly(MoveOnly
&&) = default;
40 MoveOnly2(MoveOnly2
&&) = delete;
45 using std::is_trivially_constructible
;
46 using namespace __gnu_test
;
48 static_assert(test_property
<is_trivially_constructible
,
50 static_assert(test_property
<is_trivially_constructible
,
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
,
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
,
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
,
94 static_assert(test_property
<is_trivially_constructible
,
96 static_assert(test_property
<is_trivially_constructible
,
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), "");