]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaCXX/type-traits.cpp
Vendor import of clang trunk r300422:
[FreeBSD/FreeBSD.git] / test / SemaCXX / type-traits.cpp
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++11 -fms-extensions -Wno-microsoft %s
2 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++14 -fms-extensions -Wno-microsoft %s
3 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++1z -fms-extensions -Wno-microsoft %s
4
5 #define T(b) (b) ? 1 : -1
6 #define F(b) (b) ? -1 : 1
7
8 struct NonPOD { NonPOD(int); };
9 typedef NonPOD NonPODAr[10];
10 typedef NonPOD NonPODArNB[];
11 typedef NonPOD NonPODArMB[10][2];
12
13 // PODs
14 enum Enum { EV };
15 struct POD { Enum e; int i; float f; NonPOD* p; };
16 struct Empty {};
17 typedef Empty EmptyAr[10];
18 typedef Empty EmptyArNB[];
19 typedef Empty EmptyArMB[1][2];
20 typedef int Int;
21 typedef Int IntAr[10];
22 typedef Int IntArNB[];
23 class Statics { static int priv; static NonPOD np; };
24 union EmptyUnion {};
25 union IncompleteUnion; // expected-note {{forward declaration of 'IncompleteUnion'}}
26 union Union { int i; float f; };
27 struct HasFunc { void f (); };
28 struct HasOp { void operator *(); };
29 struct HasConv { operator int(); };
30 struct HasAssign { void operator =(int); };
31
32 struct HasAnonymousUnion {
33   union {
34     int i;
35     float f;
36   };
37 };
38
39 typedef int Vector __attribute__((vector_size(16)));
40 typedef int VectorExt __attribute__((ext_vector_type(4)));
41
42 using ComplexFloat = _Complex float;
43 using ComplexInt = _Complex int;
44
45 // Not PODs
46 typedef const void cvoid;
47 struct Derives : POD {};
48 typedef Derives DerivesAr[10];
49 typedef Derives DerivesArNB[];
50 struct DerivesEmpty : Empty {};
51 struct HasCons { HasCons(int); };
52 struct HasDefaultCons { HasDefaultCons() = default; };
53 struct HasExplicitDefaultCons { explicit HasExplicitDefaultCons() = default; };
54 struct HasInheritedCons : HasDefaultCons { using HasDefaultCons::HasDefaultCons; };
55 struct HasNoInheritedCons : HasCons {};
56 struct HasCopyAssign { HasCopyAssign operator =(const HasCopyAssign&); };
57 struct HasMoveAssign { HasMoveAssign operator =(const HasMoveAssign&&); };
58 struct HasNoThrowMoveAssign { 
59   HasNoThrowMoveAssign& operator=(
60     const HasNoThrowMoveAssign&&) throw(); };
61 struct HasNoExceptNoThrowMoveAssign { 
62   HasNoExceptNoThrowMoveAssign& operator=(
63     const HasNoExceptNoThrowMoveAssign&&) noexcept; 
64 };
65 struct HasThrowMoveAssign { 
66   HasThrowMoveAssign& operator=(const HasThrowMoveAssign&&)
67 #if __cplusplus <= 201402L
68   throw(POD);
69 #else
70   noexcept(false);
71 #endif
72 };
73
74
75 struct HasNoExceptFalseMoveAssign { 
76   HasNoExceptFalseMoveAssign& operator=(
77     const HasNoExceptFalseMoveAssign&&) noexcept(false); };
78 struct HasMoveCtor { HasMoveCtor(const HasMoveCtor&&); };
79 struct HasMemberMoveCtor { HasMoveCtor member; };
80 struct HasMemberMoveAssign { HasMoveAssign member; };
81 struct HasStaticMemberMoveCtor { static HasMoveCtor member; };
82 struct HasStaticMemberMoveAssign { static HasMoveAssign member; };
83 struct HasMemberThrowMoveAssign { HasThrowMoveAssign member; };
84 struct HasMemberNoExceptFalseMoveAssign { 
85   HasNoExceptFalseMoveAssign member; };
86 struct HasMemberNoThrowMoveAssign { HasNoThrowMoveAssign member; };
87 struct HasMemberNoExceptNoThrowMoveAssign { 
88   HasNoExceptNoThrowMoveAssign member; };
89
90 struct HasDefaultTrivialCopyAssign { 
91   HasDefaultTrivialCopyAssign &operator=(
92     const HasDefaultTrivialCopyAssign&) = default; 
93 };
94 struct TrivialMoveButNotCopy { 
95   TrivialMoveButNotCopy &operator=(TrivialMoveButNotCopy&&) = default;
96   TrivialMoveButNotCopy &operator=(const TrivialMoveButNotCopy&);
97 };
98 struct NonTrivialDefault {
99   NonTrivialDefault();
100 };
101
102 struct HasDest { ~HasDest(); };
103 class  HasPriv { int priv; };
104 class  HasProt { protected: int prot; };
105 struct HasRef { int i; int& ref; HasRef() : i(0), ref(i) {} };
106 struct HasRefAggregate { int i; int& ref; };
107 struct HasNonPOD { NonPOD np; };
108 struct HasVirt { virtual void Virt() {}; };
109 typedef NonPOD NonPODAr[10];
110 typedef HasVirt VirtAr[10];
111 typedef NonPOD NonPODArNB[];
112 union NonPODUnion { int i; Derives n; };
113 struct DerivesHasCons : HasCons {};
114 struct DerivesHasCopyAssign : HasCopyAssign {};
115 struct DerivesHasMoveAssign : HasMoveAssign {};
116 struct DerivesHasDest : HasDest {};
117 struct DerivesHasPriv : HasPriv {};
118 struct DerivesHasProt : HasProt {};
119 struct DerivesHasRef : HasRef {};
120 struct DerivesHasVirt : HasVirt {};
121 struct DerivesHasMoveCtor : HasMoveCtor {};
122
123 struct HasNoThrowCopyAssign {
124   void operator =(const HasNoThrowCopyAssign&) throw();
125 };
126 struct HasMultipleCopyAssign {
127   void operator =(const HasMultipleCopyAssign&) throw();
128   void operator =(volatile HasMultipleCopyAssign&);
129 };
130 struct HasMultipleNoThrowCopyAssign {
131   void operator =(const HasMultipleNoThrowCopyAssign&) throw();
132   void operator =(volatile HasMultipleNoThrowCopyAssign&) throw();
133 };
134
135 struct HasNoThrowConstructor { HasNoThrowConstructor() throw(); };
136 struct HasNoThrowConstructorWithArgs {
137   HasNoThrowConstructorWithArgs(HasCons i = HasCons(0)) throw();
138 };
139 struct HasMultipleDefaultConstructor1 {
140   HasMultipleDefaultConstructor1() throw();
141   HasMultipleDefaultConstructor1(int i = 0);
142 };
143 struct HasMultipleDefaultConstructor2 {
144   HasMultipleDefaultConstructor2(int i = 0);
145   HasMultipleDefaultConstructor2() throw();
146 };
147
148 struct HasNoThrowCopy { HasNoThrowCopy(const HasNoThrowCopy&) throw(); };
149 struct HasMultipleCopy {
150   HasMultipleCopy(const HasMultipleCopy&) throw();
151   HasMultipleCopy(volatile HasMultipleCopy&);
152 };
153 struct HasMultipleNoThrowCopy {
154   HasMultipleNoThrowCopy(const HasMultipleNoThrowCopy&) throw();
155   HasMultipleNoThrowCopy(volatile HasMultipleNoThrowCopy&) throw();
156 };
157
158 struct HasVirtDest { virtual ~HasVirtDest(); };
159 struct DerivedVirtDest : HasVirtDest {};
160 typedef HasVirtDest VirtDestAr[1];
161
162 class AllPrivate {
163   AllPrivate() throw();
164   AllPrivate(const AllPrivate&) throw();
165   AllPrivate &operator=(const AllPrivate &) throw();
166   ~AllPrivate() throw();
167 };
168
169 struct ThreeArgCtor {
170   ThreeArgCtor(int*, char*, int);
171 };
172
173 struct VariadicCtor {
174   template<typename...T> VariadicCtor(T...);
175 };
176
177 struct ThrowingDtor {
178   ~ThrowingDtor()
179 #if __cplusplus <= 201402L
180   throw(int);
181 #else
182   noexcept(false);
183 #endif
184 };
185
186 struct NoExceptDtor {
187   ~NoExceptDtor() noexcept(true);
188 };
189
190 struct NoThrowDtor {
191   ~NoThrowDtor() throw();
192 };
193
194 struct ACompleteType {};
195 struct AnIncompleteType; // expected-note 1+ {{forward declaration of 'AnIncompleteType'}}
196 typedef AnIncompleteType AnIncompleteTypeAr[42];
197 typedef AnIncompleteType AnIncompleteTypeArNB[];
198 typedef AnIncompleteType AnIncompleteTypeArMB[1][10];
199
200 struct HasInClassInit {
201   int x = 42;
202 };
203
204 struct HasPrivateBase : private ACompleteType {};
205 struct HasProtectedBase : protected ACompleteType {};
206 struct HasVirtBase : virtual ACompleteType {};
207
208 void is_pod()
209 {
210   { int arr[T(__is_pod(int))]; }
211   { int arr[T(__is_pod(Enum))]; }
212   { int arr[T(__is_pod(POD))]; }
213   { int arr[T(__is_pod(Int))]; }
214   { int arr[T(__is_pod(IntAr))]; }
215   { int arr[T(__is_pod(Statics))]; }
216   { int arr[T(__is_pod(Empty))]; }
217   { int arr[T(__is_pod(EmptyUnion))]; }
218   { int arr[T(__is_pod(Union))]; }
219   { int arr[T(__is_pod(HasFunc))]; }
220   { int arr[T(__is_pod(HasOp))]; }
221   { int arr[T(__is_pod(HasConv))]; }
222   { int arr[T(__is_pod(HasAssign))]; }
223   { int arr[T(__is_pod(IntArNB))]; }
224   { int arr[T(__is_pod(HasAnonymousUnion))]; }
225   { int arr[T(__is_pod(Vector))]; }
226   { int arr[T(__is_pod(VectorExt))]; }
227   { int arr[T(__is_pod(Derives))]; }
228   { int arr[T(__is_pod(DerivesAr))]; }
229   { int arr[T(__is_pod(DerivesArNB))]; }
230   { int arr[T(__is_pod(DerivesEmpty))]; }
231   { int arr[T(__is_pod(HasPriv))]; }
232   { int arr[T(__is_pod(HasProt))]; }
233   { int arr[T(__is_pod(DerivesHasPriv))]; }
234   { int arr[T(__is_pod(DerivesHasProt))]; }
235
236   { int arr[F(__is_pod(HasCons))]; }
237   { int arr[F(__is_pod(HasCopyAssign))]; }
238   { int arr[F(__is_pod(HasMoveAssign))]; }
239   { int arr[F(__is_pod(HasDest))]; }
240   { int arr[F(__is_pod(HasRef))]; }
241   { int arr[F(__is_pod(HasVirt))]; }
242   { int arr[F(__is_pod(DerivesHasCons))]; }
243   { int arr[F(__is_pod(DerivesHasCopyAssign))]; }
244   { int arr[F(__is_pod(DerivesHasMoveAssign))]; }
245   { int arr[F(__is_pod(DerivesHasDest))]; }
246   { int arr[F(__is_pod(DerivesHasRef))]; }
247   { int arr[F(__is_pod(DerivesHasVirt))]; }
248   { int arr[F(__is_pod(NonPOD))]; }
249   { int arr[F(__is_pod(HasNonPOD))]; }
250   { int arr[F(__is_pod(NonPODAr))]; }
251   { int arr[F(__is_pod(NonPODArNB))]; }
252   { int arr[F(__is_pod(void))]; }
253   { int arr[F(__is_pod(cvoid))]; }
254 // { int arr[F(__is_pod(NonPODUnion))]; }
255 }
256
257 typedef Empty EmptyAr[10];
258 struct Bit0 { int : 0; };
259 struct Bit0Cons { int : 0; Bit0Cons(); };
260 struct BitOnly { int x : 3; };
261 struct DerivesVirt : virtual POD {};
262
263 void is_empty()
264 {
265   { int arr[T(__is_empty(Empty))]; }
266   { int arr[T(__is_empty(DerivesEmpty))]; }
267   { int arr[T(__is_empty(HasCons))]; }
268   { int arr[T(__is_empty(HasCopyAssign))]; }
269   { int arr[T(__is_empty(HasMoveAssign))]; }
270   { int arr[T(__is_empty(HasDest))]; }
271   { int arr[T(__is_empty(HasFunc))]; }
272   { int arr[T(__is_empty(HasOp))]; }
273   { int arr[T(__is_empty(HasConv))]; }
274   { int arr[T(__is_empty(HasAssign))]; }
275   { int arr[T(__is_empty(Bit0))]; }
276   { int arr[T(__is_empty(Bit0Cons))]; }
277
278   { int arr[F(__is_empty(Int))]; }
279   { int arr[F(__is_empty(POD))]; }
280   { int arr[F(__is_empty(EmptyUnion))]; }
281   { int arr[F(__is_empty(IncompleteUnion))]; }
282   { int arr[F(__is_empty(EmptyAr))]; }
283   { int arr[F(__is_empty(HasRef))]; }
284   { int arr[F(__is_empty(HasVirt))]; }
285   { int arr[F(__is_empty(BitOnly))]; }
286   { int arr[F(__is_empty(void))]; }
287   { int arr[F(__is_empty(IntArNB))]; }
288   { int arr[F(__is_empty(HasAnonymousUnion))]; }
289 //  { int arr[F(__is_empty(DerivesVirt))]; }
290 }
291
292 typedef Derives ClassType;
293
294 void is_class()
295 {
296   { int arr[T(__is_class(Derives))]; }
297   { int arr[T(__is_class(HasPriv))]; }
298   { int arr[T(__is_class(ClassType))]; }
299   { int arr[T(__is_class(HasAnonymousUnion))]; }
300
301   { int arr[F(__is_class(int))]; }
302   { int arr[F(__is_class(Enum))]; }
303   { int arr[F(__is_class(Int))]; }
304   { int arr[F(__is_class(IntAr))]; }
305   { int arr[F(__is_class(DerivesAr))]; }
306   { int arr[F(__is_class(Union))]; }
307   { int arr[F(__is_class(cvoid))]; }
308   { int arr[F(__is_class(IntArNB))]; }
309 }
310
311 typedef Union UnionAr[10];
312 typedef Union UnionType;
313
314 void is_union()
315 {
316   { int arr[T(__is_union(Union))]; }
317   { int arr[T(__is_union(UnionType))]; }
318
319   { int arr[F(__is_union(int))]; }
320   { int arr[F(__is_union(Enum))]; }
321   { int arr[F(__is_union(Int))]; }
322   { int arr[F(__is_union(IntAr))]; }
323   { int arr[F(__is_union(UnionAr))]; }
324   { int arr[F(__is_union(cvoid))]; }
325   { int arr[F(__is_union(IntArNB))]; }
326   { int arr[F(__is_union(HasAnonymousUnion))]; }
327 }
328
329 typedef Enum EnumType;
330
331 void is_enum()
332 {
333   { int arr[T(__is_enum(Enum))]; }
334   { int arr[T(__is_enum(EnumType))]; }
335
336   { int arr[F(__is_enum(int))]; }
337   { int arr[F(__is_enum(Union))]; }
338   { int arr[F(__is_enum(Int))]; }
339   { int arr[F(__is_enum(IntAr))]; }
340   { int arr[F(__is_enum(UnionAr))]; }
341   { int arr[F(__is_enum(Derives))]; }
342   { int arr[F(__is_enum(ClassType))]; }
343   { int arr[F(__is_enum(cvoid))]; }
344   { int arr[F(__is_enum(IntArNB))]; }
345   { int arr[F(__is_enum(HasAnonymousUnion))]; }
346 }
347
348 struct FinalClass final {
349 };
350
351 template<typename T> 
352 struct PotentiallyFinal { };
353
354 template<typename T>
355 struct PotentiallyFinal<T*> final { };
356
357 template<>
358 struct PotentiallyFinal<int> final { };
359
360 struct SealedClass sealed {
361 };
362
363 template<typename T>
364 struct PotentiallySealed { };
365
366 template<typename T>
367 struct PotentiallySealed<T*> sealed { };
368
369 template<>
370 struct PotentiallySealed<int> sealed { };
371
372 void is_final()
373 {
374         { int arr[T(__is_final(SealedClass))]; }
375         { int arr[T(__is_final(PotentiallySealed<float*>))]; }
376         { int arr[T(__is_final(PotentiallySealed<int>))]; }
377         { int arr[T(__is_final(FinalClass))]; }
378         { int arr[T(__is_final(PotentiallyFinal<float*>))]; }
379         { int arr[T(__is_final(PotentiallyFinal<int>))]; }
380
381         { int arr[F(__is_final(int))]; }
382         { int arr[F(__is_final(Union))]; }
383         { int arr[F(__is_final(Int))]; }
384         { int arr[F(__is_final(IntAr))]; }
385         { int arr[F(__is_final(UnionAr))]; }
386         { int arr[F(__is_final(Derives))]; }
387         { int arr[F(__is_final(ClassType))]; }
388         { int arr[F(__is_final(cvoid))]; }
389         { int arr[F(__is_final(IntArNB))]; }
390         { int arr[F(__is_final(HasAnonymousUnion))]; }
391         { int arr[F(__is_final(PotentiallyFinal<float>))]; }
392         { int arr[F(__is_final(PotentiallySealed<float>))]; }
393 }
394
395 void is_sealed()
396 {
397         { int arr[T(__is_sealed(SealedClass))]; }
398         { int arr[T(__is_sealed(PotentiallySealed<float*>))]; }
399         { int arr[T(__is_sealed(PotentiallySealed<int>))]; }
400         { int arr[T(__is_sealed(FinalClass))]; }
401         { int arr[T(__is_sealed(PotentiallyFinal<float*>))]; }
402         { int arr[T(__is_sealed(PotentiallyFinal<int>))]; }
403
404         { int arr[F(__is_sealed(int))]; }
405         { int arr[F(__is_sealed(Union))]; }
406         { int arr[F(__is_sealed(Int))]; }
407         { int arr[F(__is_sealed(IntAr))]; }
408         { int arr[F(__is_sealed(UnionAr))]; }
409         { int arr[F(__is_sealed(Derives))]; }
410         { int arr[F(__is_sealed(ClassType))]; }
411         { int arr[F(__is_sealed(cvoid))]; }
412         { int arr[F(__is_sealed(IntArNB))]; }
413         { int arr[F(__is_sealed(HasAnonymousUnion))]; }
414         { int arr[F(__is_sealed(PotentiallyFinal<float>))]; }
415         { int arr[F(__is_sealed(PotentiallySealed<float>))]; }
416 }
417
418 typedef HasVirt Polymorph;
419 struct InheritPolymorph : Polymorph {};
420
421 void is_polymorphic()
422 {
423   { int arr[T(__is_polymorphic(Polymorph))]; }
424   { int arr[T(__is_polymorphic(InheritPolymorph))]; }
425
426   { int arr[F(__is_polymorphic(int))]; }
427   { int arr[F(__is_polymorphic(Union))]; }
428   { int arr[F(__is_polymorphic(IncompleteUnion))]; }
429   { int arr[F(__is_polymorphic(Int))]; }
430   { int arr[F(__is_polymorphic(IntAr))]; }
431   { int arr[F(__is_polymorphic(UnionAr))]; }
432   { int arr[F(__is_polymorphic(Derives))]; }
433   { int arr[F(__is_polymorphic(ClassType))]; }
434   { int arr[F(__is_polymorphic(Enum))]; }
435   { int arr[F(__is_polymorphic(cvoid))]; }
436   { int arr[F(__is_polymorphic(IntArNB))]; }
437 }
438
439 void is_integral()
440 {
441   int t01[T(__is_integral(bool))];
442   int t02[T(__is_integral(char))];
443   int t03[T(__is_integral(signed char))];
444   int t04[T(__is_integral(unsigned char))];
445   //int t05[T(__is_integral(char16_t))];
446   //int t06[T(__is_integral(char32_t))];
447   int t07[T(__is_integral(wchar_t))];
448   int t08[T(__is_integral(short))];
449   int t09[T(__is_integral(unsigned short))];
450   int t10[T(__is_integral(int))];
451   int t11[T(__is_integral(unsigned int))];
452   int t12[T(__is_integral(long))];
453   int t13[T(__is_integral(unsigned long))];
454
455   int t21[F(__is_integral(float))];
456   int t22[F(__is_integral(double))];
457   int t23[F(__is_integral(long double))];
458   int t24[F(__is_integral(Union))];
459   int t25[F(__is_integral(UnionAr))];
460   int t26[F(__is_integral(Derives))];
461   int t27[F(__is_integral(ClassType))];
462   int t28[F(__is_integral(Enum))];
463   int t29[F(__is_integral(void))];
464   int t30[F(__is_integral(cvoid))];
465   int t31[F(__is_integral(IntArNB))];
466 }
467
468 void is_floating_point()
469 {
470   int t01[T(__is_floating_point(float))];
471   int t02[T(__is_floating_point(double))];
472   int t03[T(__is_floating_point(long double))];
473
474   int t11[F(__is_floating_point(bool))];
475   int t12[F(__is_floating_point(char))];
476   int t13[F(__is_floating_point(signed char))];
477   int t14[F(__is_floating_point(unsigned char))];
478   //int t15[F(__is_floating_point(char16_t))];
479   //int t16[F(__is_floating_point(char32_t))];
480   int t17[F(__is_floating_point(wchar_t))];
481   int t18[F(__is_floating_point(short))];
482   int t19[F(__is_floating_point(unsigned short))];
483   int t20[F(__is_floating_point(int))];
484   int t21[F(__is_floating_point(unsigned int))];
485   int t22[F(__is_floating_point(long))];
486   int t23[F(__is_floating_point(unsigned long))];
487   int t24[F(__is_floating_point(Union))];
488   int t25[F(__is_floating_point(UnionAr))];
489   int t26[F(__is_floating_point(Derives))];
490   int t27[F(__is_floating_point(ClassType))];
491   int t28[F(__is_floating_point(Enum))];
492   int t29[F(__is_floating_point(void))];
493   int t30[F(__is_floating_point(cvoid))];
494   int t31[F(__is_floating_point(IntArNB))];
495 }
496
497 template <class T>
498 struct AggregateTemplate {
499   T value;
500 };
501
502 template <class T>
503 struct NonAggregateTemplate {
504   T value;
505   NonAggregateTemplate();
506 };
507
508 void is_aggregate()
509 {
510   constexpr bool TrueAfterCpp11 = __cplusplus > 201103L;
511   constexpr bool TrueAfterCpp14 = __cplusplus > 201402L;
512
513   __is_aggregate(AnIncompleteType); // expected-error {{incomplete type}}
514   __is_aggregate(AnIncompleteTypeAr); // expected-error {{incomplete type}}
515   __is_aggregate(AnIncompleteTypeArNB); // expected-error {{incomplete type}}
516   __is_aggregate(AnIncompleteTypeArMB); // expected-error {{incomplete type}}
517   __is_aggregate(IncompleteUnion); // expected-error {{incomplete type}}
518
519   static_assert(!__is_aggregate(NonPOD), "");
520   static_assert(__is_aggregate(NonPODAr), "");
521   static_assert(__is_aggregate(NonPODArNB), "");
522   static_assert(__is_aggregate(NonPODArMB), "");
523
524   static_assert(!__is_aggregate(Enum), "");
525   static_assert(__is_aggregate(POD), "");
526   static_assert(__is_aggregate(Empty), "");
527   static_assert(__is_aggregate(EmptyAr), "");
528   static_assert(__is_aggregate(EmptyArNB), "");
529   static_assert(__is_aggregate(EmptyArMB), "");
530   static_assert(!__is_aggregate(void), "");
531   static_assert(!__is_aggregate(const volatile void), "");
532   static_assert(!__is_aggregate(int), "");
533   static_assert(__is_aggregate(IntAr), "");
534   static_assert(__is_aggregate(IntArNB), "");
535   static_assert(__is_aggregate(EmptyUnion), "");
536   static_assert(__is_aggregate(Union), "");
537   static_assert(__is_aggregate(Statics), "");
538   static_assert(__is_aggregate(HasFunc), "");
539   static_assert(__is_aggregate(HasOp), "");
540   static_assert(__is_aggregate(HasAssign), "");
541   static_assert(__is_aggregate(HasAnonymousUnion), "");
542
543   static_assert(__is_aggregate(Derives) == TrueAfterCpp14, "");
544   static_assert(__is_aggregate(DerivesAr), "");
545   static_assert(__is_aggregate(DerivesArNB), "");
546   static_assert(!__is_aggregate(HasCons), "");
547   static_assert(__is_aggregate(HasDefaultCons), "");
548   static_assert(!__is_aggregate(HasExplicitDefaultCons), "");
549   static_assert(!__is_aggregate(HasInheritedCons), "");
550   static_assert(__is_aggregate(HasNoInheritedCons) == TrueAfterCpp14, "");
551   static_assert(__is_aggregate(HasCopyAssign), "");
552   static_assert(!__is_aggregate(NonTrivialDefault), "");
553   static_assert(__is_aggregate(HasDest), "");
554   static_assert(!__is_aggregate(HasPriv), "");
555   static_assert(!__is_aggregate(HasProt), "");
556   static_assert(__is_aggregate(HasRefAggregate), "");
557   static_assert(__is_aggregate(HasNonPOD), "");
558   static_assert(!__is_aggregate(HasVirt), "");
559   static_assert(__is_aggregate(VirtAr), "");
560   static_assert(__is_aggregate(HasInClassInit) == TrueAfterCpp11, "");
561   static_assert(!__is_aggregate(HasPrivateBase), "");
562   static_assert(!__is_aggregate(HasProtectedBase), "");
563   static_assert(!__is_aggregate(HasVirtBase), "");
564
565   static_assert(__is_aggregate(AggregateTemplate<int>), "");
566   static_assert(!__is_aggregate(NonAggregateTemplate<int>), "");
567
568   static_assert(__is_aggregate(Vector), ""); // Extension supported by GCC and Clang
569   static_assert(__is_aggregate(VectorExt), "");
570   static_assert(__is_aggregate(ComplexInt), "");
571   static_assert(__is_aggregate(ComplexFloat), "");
572 }
573
574 void is_arithmetic()
575 {
576   int t01[T(__is_arithmetic(float))];
577   int t02[T(__is_arithmetic(double))];
578   int t03[T(__is_arithmetic(long double))];
579   int t11[T(__is_arithmetic(bool))];
580   int t12[T(__is_arithmetic(char))];
581   int t13[T(__is_arithmetic(signed char))];
582   int t14[T(__is_arithmetic(unsigned char))];
583   //int t15[T(__is_arithmetic(char16_t))];
584   //int t16[T(__is_arithmetic(char32_t))];
585   int t17[T(__is_arithmetic(wchar_t))];
586   int t18[T(__is_arithmetic(short))];
587   int t19[T(__is_arithmetic(unsigned short))];
588   int t20[T(__is_arithmetic(int))];
589   int t21[T(__is_arithmetic(unsigned int))];
590   int t22[T(__is_arithmetic(long))];
591   int t23[T(__is_arithmetic(unsigned long))];
592
593   int t24[F(__is_arithmetic(Union))];
594   int t25[F(__is_arithmetic(UnionAr))];
595   int t26[F(__is_arithmetic(Derives))];
596   int t27[F(__is_arithmetic(ClassType))];
597   int t28[F(__is_arithmetic(Enum))];
598   int t29[F(__is_arithmetic(void))];
599   int t30[F(__is_arithmetic(cvoid))];
600   int t31[F(__is_arithmetic(IntArNB))];
601 }
602
603 void is_complete_type()
604 {
605   int t01[T(__is_complete_type(float))];
606   int t02[T(__is_complete_type(double))];
607   int t03[T(__is_complete_type(long double))];
608   int t11[T(__is_complete_type(bool))];
609   int t12[T(__is_complete_type(char))];
610   int t13[T(__is_complete_type(signed char))];
611   int t14[T(__is_complete_type(unsigned char))];
612   //int t15[T(__is_complete_type(char16_t))];
613   //int t16[T(__is_complete_type(char32_t))];
614   int t17[T(__is_complete_type(wchar_t))];
615   int t18[T(__is_complete_type(short))];
616   int t19[T(__is_complete_type(unsigned short))];
617   int t20[T(__is_complete_type(int))];
618   int t21[T(__is_complete_type(unsigned int))];
619   int t22[T(__is_complete_type(long))];
620   int t23[T(__is_complete_type(unsigned long))];
621   int t24[T(__is_complete_type(ACompleteType))];
622
623   int t30[F(__is_complete_type(AnIncompleteType))];
624 }
625
626 void is_void()
627 {
628   int t01[T(__is_void(void))];
629   int t02[T(__is_void(cvoid))];
630
631   int t10[F(__is_void(float))];
632   int t11[F(__is_void(double))];
633   int t12[F(__is_void(long double))];
634   int t13[F(__is_void(bool))];
635   int t14[F(__is_void(char))];
636   int t15[F(__is_void(signed char))];
637   int t16[F(__is_void(unsigned char))];
638   int t17[F(__is_void(wchar_t))];
639   int t18[F(__is_void(short))];
640   int t19[F(__is_void(unsigned short))];
641   int t20[F(__is_void(int))];
642   int t21[F(__is_void(unsigned int))];
643   int t22[F(__is_void(long))];
644   int t23[F(__is_void(unsigned long))];
645   int t24[F(__is_void(Union))];
646   int t25[F(__is_void(UnionAr))];
647   int t26[F(__is_void(Derives))];
648   int t27[F(__is_void(ClassType))];
649   int t28[F(__is_void(Enum))];
650   int t29[F(__is_void(IntArNB))];
651   int t30[F(__is_void(void*))];
652   int t31[F(__is_void(cvoid*))];
653 }
654
655 void is_array()
656 {
657   int t01[T(__is_array(IntAr))];
658   int t02[T(__is_array(IntArNB))];
659   int t03[T(__is_array(UnionAr))];
660
661   int t10[F(__is_array(void))];
662   int t11[F(__is_array(cvoid))];
663   int t12[F(__is_array(float))];
664   int t13[F(__is_array(double))];
665   int t14[F(__is_array(long double))];
666   int t15[F(__is_array(bool))];
667   int t16[F(__is_array(char))];
668   int t17[F(__is_array(signed char))];
669   int t18[F(__is_array(unsigned char))];
670   int t19[F(__is_array(wchar_t))];
671   int t20[F(__is_array(short))];
672   int t21[F(__is_array(unsigned short))];
673   int t22[F(__is_array(int))];
674   int t23[F(__is_array(unsigned int))];
675   int t24[F(__is_array(long))];
676   int t25[F(__is_array(unsigned long))];
677   int t26[F(__is_array(Union))];
678   int t27[F(__is_array(Derives))];
679   int t28[F(__is_array(ClassType))];
680   int t29[F(__is_array(Enum))];
681   int t30[F(__is_array(void*))];
682   int t31[F(__is_array(cvoid*))];
683 }
684
685 template <typename T> void tmpl_func(T&) {}
686
687 template <typename T> struct type_wrapper {
688   typedef T type;
689   typedef T* ptrtype;
690   typedef T& reftype;
691 };
692
693 void is_function()
694 {
695   int t01[T(__is_function(type_wrapper<void(void)>::type))];
696   int t02[T(__is_function(typeof(tmpl_func<int>)))];
697
698   typedef void (*ptr_to_func_type)(void);
699
700   int t10[F(__is_function(void))];
701   int t11[F(__is_function(cvoid))];
702   int t12[F(__is_function(float))];
703   int t13[F(__is_function(double))];
704   int t14[F(__is_function(long double))];
705   int t15[F(__is_function(bool))];
706   int t16[F(__is_function(char))];
707   int t17[F(__is_function(signed char))];
708   int t18[F(__is_function(unsigned char))];
709   int t19[F(__is_function(wchar_t))];
710   int t20[F(__is_function(short))];
711   int t21[F(__is_function(unsigned short))];
712   int t22[F(__is_function(int))];
713   int t23[F(__is_function(unsigned int))];
714   int t24[F(__is_function(long))];
715   int t25[F(__is_function(unsigned long))];
716   int t26[F(__is_function(Union))];
717   int t27[F(__is_function(Derives))];
718   int t28[F(__is_function(ClassType))];
719   int t29[F(__is_function(Enum))];
720   int t30[F(__is_function(void*))];
721   int t31[F(__is_function(cvoid*))];
722   int t32[F(__is_function(void(*)()))];
723   int t33[F(__is_function(ptr_to_func_type))];
724   int t34[F(__is_function(type_wrapper<void(void)>::ptrtype))];
725   int t35[F(__is_function(type_wrapper<void(void)>::reftype))];
726 }
727
728 void is_reference()
729 {
730   int t01[T(__is_reference(int&))];
731   int t02[T(__is_reference(const int&))];
732   int t03[T(__is_reference(void *&))];
733
734   int t10[F(__is_reference(int))];
735   int t11[F(__is_reference(const int))];
736   int t12[F(__is_reference(void *))];
737 }
738
739 void is_lvalue_reference()
740 {
741   int t01[T(__is_lvalue_reference(int&))];
742   int t02[T(__is_lvalue_reference(void *&))];
743   int t03[T(__is_lvalue_reference(const int&))];
744   int t04[T(__is_lvalue_reference(void * const &))];
745
746   int t10[F(__is_lvalue_reference(int))];
747   int t11[F(__is_lvalue_reference(const int))];
748   int t12[F(__is_lvalue_reference(void *))];
749 }
750
751 #if __has_feature(cxx_rvalue_references)
752
753 void is_rvalue_reference()
754 {
755   int t01[T(__is_rvalue_reference(const int&&))];
756   int t02[T(__is_rvalue_reference(void * const &&))];
757
758   int t10[F(__is_rvalue_reference(int&))];
759   int t11[F(__is_rvalue_reference(void *&))];
760   int t12[F(__is_rvalue_reference(const int&))];
761   int t13[F(__is_rvalue_reference(void * const &))];
762   int t14[F(__is_rvalue_reference(int))];
763   int t15[F(__is_rvalue_reference(const int))];
764   int t16[F(__is_rvalue_reference(void *))];
765 }
766
767 #endif
768
769 void is_fundamental()
770 {
771   int t01[T(__is_fundamental(float))];
772   int t02[T(__is_fundamental(double))];
773   int t03[T(__is_fundamental(long double))];
774   int t11[T(__is_fundamental(bool))];
775   int t12[T(__is_fundamental(char))];
776   int t13[T(__is_fundamental(signed char))];
777   int t14[T(__is_fundamental(unsigned char))];
778   //int t15[T(__is_fundamental(char16_t))];
779   //int t16[T(__is_fundamental(char32_t))];
780   int t17[T(__is_fundamental(wchar_t))];
781   int t18[T(__is_fundamental(short))];
782   int t19[T(__is_fundamental(unsigned short))];
783   int t20[T(__is_fundamental(int))];
784   int t21[T(__is_fundamental(unsigned int))];
785   int t22[T(__is_fundamental(long))];
786   int t23[T(__is_fundamental(unsigned long))];
787   int t24[T(__is_fundamental(void))];
788   int t25[T(__is_fundamental(cvoid))];
789
790   int t30[F(__is_fundamental(Union))];
791   int t31[F(__is_fundamental(UnionAr))];
792   int t32[F(__is_fundamental(Derives))];
793   int t33[F(__is_fundamental(ClassType))];
794   int t34[F(__is_fundamental(Enum))];
795   int t35[F(__is_fundamental(IntArNB))];
796 }
797
798 void is_object()
799 {
800   int t01[T(__is_object(int))];
801   int t02[T(__is_object(int *))];
802   int t03[T(__is_object(void *))];
803   int t04[T(__is_object(Union))];
804   int t05[T(__is_object(UnionAr))];
805   int t06[T(__is_object(ClassType))];
806   int t07[T(__is_object(Enum))];
807
808   int t10[F(__is_object(type_wrapper<void(void)>::type))];
809   int t11[F(__is_object(int&))];
810   int t12[F(__is_object(void))];
811 }
812
813 void is_scalar()
814 {
815   int t01[T(__is_scalar(float))];
816   int t02[T(__is_scalar(double))];
817   int t03[T(__is_scalar(long double))];
818   int t04[T(__is_scalar(bool))];
819   int t05[T(__is_scalar(char))];
820   int t06[T(__is_scalar(signed char))];
821   int t07[T(__is_scalar(unsigned char))];
822   int t08[T(__is_scalar(wchar_t))];
823   int t09[T(__is_scalar(short))];
824   int t10[T(__is_scalar(unsigned short))];
825   int t11[T(__is_scalar(int))];
826   int t12[T(__is_scalar(unsigned int))];
827   int t13[T(__is_scalar(long))];
828   int t14[T(__is_scalar(unsigned long))];
829   int t15[T(__is_scalar(Enum))];
830   int t16[T(__is_scalar(void*))];
831   int t17[T(__is_scalar(cvoid*))];
832
833   int t20[F(__is_scalar(void))];
834   int t21[F(__is_scalar(cvoid))];
835   int t22[F(__is_scalar(Union))];
836   int t23[F(__is_scalar(UnionAr))];
837   int t24[F(__is_scalar(Derives))];
838   int t25[F(__is_scalar(ClassType))];
839   int t26[F(__is_scalar(IntArNB))];
840 }
841
842 struct StructWithMembers {
843   int member;
844   void method() {}
845 };
846
847 void is_compound()
848 {
849   int t01[T(__is_compound(void*))];
850   int t02[T(__is_compound(cvoid*))];
851   int t03[T(__is_compound(void (*)()))];
852   int t04[T(__is_compound(int StructWithMembers::*))];
853   int t05[T(__is_compound(void (StructWithMembers::*)()))];
854   int t06[T(__is_compound(int&))];
855   int t07[T(__is_compound(Union))];
856   int t08[T(__is_compound(UnionAr))];
857   int t09[T(__is_compound(Derives))];
858   int t10[T(__is_compound(ClassType))];
859   int t11[T(__is_compound(IntArNB))];
860   int t12[T(__is_compound(Enum))];
861
862   int t20[F(__is_compound(float))];
863   int t21[F(__is_compound(double))];
864   int t22[F(__is_compound(long double))];
865   int t23[F(__is_compound(bool))];
866   int t24[F(__is_compound(char))];
867   int t25[F(__is_compound(signed char))];
868   int t26[F(__is_compound(unsigned char))];
869   int t27[F(__is_compound(wchar_t))];
870   int t28[F(__is_compound(short))];
871   int t29[F(__is_compound(unsigned short))];
872   int t30[F(__is_compound(int))];
873   int t31[F(__is_compound(unsigned int))];
874   int t32[F(__is_compound(long))];
875   int t33[F(__is_compound(unsigned long))];
876   int t34[F(__is_compound(void))];
877   int t35[F(__is_compound(cvoid))];
878 }
879
880 void is_pointer()
881 {
882   StructWithMembers x;
883
884   int t01[T(__is_pointer(void*))];
885   int t02[T(__is_pointer(cvoid*))];
886   int t03[T(__is_pointer(cvoid*))];
887   int t04[T(__is_pointer(char*))];
888   int t05[T(__is_pointer(int*))];
889   int t06[T(__is_pointer(int**))];
890   int t07[T(__is_pointer(ClassType*))];
891   int t08[T(__is_pointer(Derives*))];
892   int t09[T(__is_pointer(Enum*))];
893   int t10[T(__is_pointer(IntArNB*))];
894   int t11[T(__is_pointer(Union*))];
895   int t12[T(__is_pointer(UnionAr*))];
896   int t13[T(__is_pointer(StructWithMembers*))];
897   int t14[T(__is_pointer(void (*)()))];
898
899   int t20[F(__is_pointer(void))];
900   int t21[F(__is_pointer(cvoid))];
901   int t22[F(__is_pointer(cvoid))];
902   int t23[F(__is_pointer(char))];
903   int t24[F(__is_pointer(int))];
904   int t25[F(__is_pointer(int))];
905   int t26[F(__is_pointer(ClassType))];
906   int t27[F(__is_pointer(Derives))];
907   int t28[F(__is_pointer(Enum))];
908   int t29[F(__is_pointer(IntArNB))];
909   int t30[F(__is_pointer(Union))];
910   int t31[F(__is_pointer(UnionAr))];
911   int t32[F(__is_pointer(StructWithMembers))];
912   int t33[F(__is_pointer(int StructWithMembers::*))];
913   int t34[F(__is_pointer(void (StructWithMembers::*) ()))];
914 }
915
916 void is_member_object_pointer()
917 {
918   StructWithMembers x;
919
920   int t01[T(__is_member_object_pointer(int StructWithMembers::*))];
921
922   int t10[F(__is_member_object_pointer(void (StructWithMembers::*) ()))];
923   int t11[F(__is_member_object_pointer(void*))];
924   int t12[F(__is_member_object_pointer(cvoid*))];
925   int t13[F(__is_member_object_pointer(cvoid*))];
926   int t14[F(__is_member_object_pointer(char*))];
927   int t15[F(__is_member_object_pointer(int*))];
928   int t16[F(__is_member_object_pointer(int**))];
929   int t17[F(__is_member_object_pointer(ClassType*))];
930   int t18[F(__is_member_object_pointer(Derives*))];
931   int t19[F(__is_member_object_pointer(Enum*))];
932   int t20[F(__is_member_object_pointer(IntArNB*))];
933   int t21[F(__is_member_object_pointer(Union*))];
934   int t22[F(__is_member_object_pointer(UnionAr*))];
935   int t23[F(__is_member_object_pointer(StructWithMembers*))];
936   int t24[F(__is_member_object_pointer(void))];
937   int t25[F(__is_member_object_pointer(cvoid))];
938   int t26[F(__is_member_object_pointer(cvoid))];
939   int t27[F(__is_member_object_pointer(char))];
940   int t28[F(__is_member_object_pointer(int))];
941   int t29[F(__is_member_object_pointer(int))];
942   int t30[F(__is_member_object_pointer(ClassType))];
943   int t31[F(__is_member_object_pointer(Derives))];
944   int t32[F(__is_member_object_pointer(Enum))];
945   int t33[F(__is_member_object_pointer(IntArNB))];
946   int t34[F(__is_member_object_pointer(Union))];
947   int t35[F(__is_member_object_pointer(UnionAr))];
948   int t36[F(__is_member_object_pointer(StructWithMembers))];
949   int t37[F(__is_member_object_pointer(void (*)()))];
950 }
951
952 void is_member_function_pointer()
953 {
954   StructWithMembers x;
955
956   int t01[T(__is_member_function_pointer(void (StructWithMembers::*) ()))];
957
958   int t10[F(__is_member_function_pointer(int StructWithMembers::*))];
959   int t11[F(__is_member_function_pointer(void*))];
960   int t12[F(__is_member_function_pointer(cvoid*))];
961   int t13[F(__is_member_function_pointer(cvoid*))];
962   int t14[F(__is_member_function_pointer(char*))];
963   int t15[F(__is_member_function_pointer(int*))];
964   int t16[F(__is_member_function_pointer(int**))];
965   int t17[F(__is_member_function_pointer(ClassType*))];
966   int t18[F(__is_member_function_pointer(Derives*))];
967   int t19[F(__is_member_function_pointer(Enum*))];
968   int t20[F(__is_member_function_pointer(IntArNB*))];
969   int t21[F(__is_member_function_pointer(Union*))];
970   int t22[F(__is_member_function_pointer(UnionAr*))];
971   int t23[F(__is_member_function_pointer(StructWithMembers*))];
972   int t24[F(__is_member_function_pointer(void))];
973   int t25[F(__is_member_function_pointer(cvoid))];
974   int t26[F(__is_member_function_pointer(cvoid))];
975   int t27[F(__is_member_function_pointer(char))];
976   int t28[F(__is_member_function_pointer(int))];
977   int t29[F(__is_member_function_pointer(int))];
978   int t30[F(__is_member_function_pointer(ClassType))];
979   int t31[F(__is_member_function_pointer(Derives))];
980   int t32[F(__is_member_function_pointer(Enum))];
981   int t33[F(__is_member_function_pointer(IntArNB))];
982   int t34[F(__is_member_function_pointer(Union))];
983   int t35[F(__is_member_function_pointer(UnionAr))];
984   int t36[F(__is_member_function_pointer(StructWithMembers))];
985   int t37[F(__is_member_function_pointer(void (*)()))];
986 }
987
988 void is_member_pointer()
989 {
990   StructWithMembers x;
991
992   int t01[T(__is_member_pointer(int StructWithMembers::*))];
993   int t02[T(__is_member_pointer(void (StructWithMembers::*) ()))];
994
995   int t10[F(__is_member_pointer(void*))];
996   int t11[F(__is_member_pointer(cvoid*))];
997   int t12[F(__is_member_pointer(cvoid*))];
998   int t13[F(__is_member_pointer(char*))];
999   int t14[F(__is_member_pointer(int*))];
1000   int t15[F(__is_member_pointer(int**))];
1001   int t16[F(__is_member_pointer(ClassType*))];
1002   int t17[F(__is_member_pointer(Derives*))];
1003   int t18[F(__is_member_pointer(Enum*))];
1004   int t19[F(__is_member_pointer(IntArNB*))];
1005   int t20[F(__is_member_pointer(Union*))];
1006   int t21[F(__is_member_pointer(UnionAr*))];
1007   int t22[F(__is_member_pointer(StructWithMembers*))];
1008   int t23[F(__is_member_pointer(void))];
1009   int t24[F(__is_member_pointer(cvoid))];
1010   int t25[F(__is_member_pointer(cvoid))];
1011   int t26[F(__is_member_pointer(char))];
1012   int t27[F(__is_member_pointer(int))];
1013   int t28[F(__is_member_pointer(int))];
1014   int t29[F(__is_member_pointer(ClassType))];
1015   int t30[F(__is_member_pointer(Derives))];
1016   int t31[F(__is_member_pointer(Enum))];
1017   int t32[F(__is_member_pointer(IntArNB))];
1018   int t33[F(__is_member_pointer(Union))];
1019   int t34[F(__is_member_pointer(UnionAr))];
1020   int t35[F(__is_member_pointer(StructWithMembers))];
1021   int t36[F(__is_member_pointer(void (*)()))];
1022 }
1023
1024 void is_const()
1025 {
1026   int t01[T(__is_const(cvoid))];
1027   int t02[T(__is_const(const char))];
1028   int t03[T(__is_const(const int))];
1029   int t04[T(__is_const(const long))];
1030   int t05[T(__is_const(const short))];
1031   int t06[T(__is_const(const signed char))];
1032   int t07[T(__is_const(const wchar_t))];
1033   int t08[T(__is_const(const bool))];
1034   int t09[T(__is_const(const float))];
1035   int t10[T(__is_const(const double))];
1036   int t11[T(__is_const(const long double))];
1037   int t12[T(__is_const(const unsigned char))];
1038   int t13[T(__is_const(const unsigned int))];
1039   int t14[T(__is_const(const unsigned long long))];
1040   int t15[T(__is_const(const unsigned long))];
1041   int t16[T(__is_const(const unsigned short))];
1042   int t17[T(__is_const(const void))];
1043   int t18[T(__is_const(const ClassType))];
1044   int t19[T(__is_const(const Derives))];
1045   int t20[T(__is_const(const Enum))];
1046   int t21[T(__is_const(const IntArNB))];
1047   int t22[T(__is_const(const Union))];
1048   int t23[T(__is_const(const UnionAr))];
1049
1050   int t30[F(__is_const(char))];
1051   int t31[F(__is_const(int))];
1052   int t32[F(__is_const(long))];
1053   int t33[F(__is_const(short))];
1054   int t34[F(__is_const(signed char))];
1055   int t35[F(__is_const(wchar_t))];
1056   int t36[F(__is_const(bool))];
1057   int t37[F(__is_const(float))];
1058   int t38[F(__is_const(double))];
1059   int t39[F(__is_const(long double))];
1060   int t40[F(__is_const(unsigned char))];
1061   int t41[F(__is_const(unsigned int))];
1062   int t42[F(__is_const(unsigned long long))];
1063   int t43[F(__is_const(unsigned long))];
1064   int t44[F(__is_const(unsigned short))];
1065   int t45[F(__is_const(void))];
1066   int t46[F(__is_const(ClassType))];
1067   int t47[F(__is_const(Derives))];
1068   int t48[F(__is_const(Enum))];
1069   int t49[F(__is_const(IntArNB))];
1070   int t50[F(__is_const(Union))];
1071   int t51[F(__is_const(UnionAr))];
1072 }
1073
1074 void is_volatile()
1075 {
1076   int t02[T(__is_volatile(volatile char))];
1077   int t03[T(__is_volatile(volatile int))];
1078   int t04[T(__is_volatile(volatile long))];
1079   int t05[T(__is_volatile(volatile short))];
1080   int t06[T(__is_volatile(volatile signed char))];
1081   int t07[T(__is_volatile(volatile wchar_t))];
1082   int t08[T(__is_volatile(volatile bool))];
1083   int t09[T(__is_volatile(volatile float))];
1084   int t10[T(__is_volatile(volatile double))];
1085   int t11[T(__is_volatile(volatile long double))];
1086   int t12[T(__is_volatile(volatile unsigned char))];
1087   int t13[T(__is_volatile(volatile unsigned int))];
1088   int t14[T(__is_volatile(volatile unsigned long long))];
1089   int t15[T(__is_volatile(volatile unsigned long))];
1090   int t16[T(__is_volatile(volatile unsigned short))];
1091   int t17[T(__is_volatile(volatile void))];
1092   int t18[T(__is_volatile(volatile ClassType))];
1093   int t19[T(__is_volatile(volatile Derives))];
1094   int t20[T(__is_volatile(volatile Enum))];
1095   int t21[T(__is_volatile(volatile IntArNB))];
1096   int t22[T(__is_volatile(volatile Union))];
1097   int t23[T(__is_volatile(volatile UnionAr))];
1098
1099   int t30[F(__is_volatile(char))];
1100   int t31[F(__is_volatile(int))];
1101   int t32[F(__is_volatile(long))];
1102   int t33[F(__is_volatile(short))];
1103   int t34[F(__is_volatile(signed char))];
1104   int t35[F(__is_volatile(wchar_t))];
1105   int t36[F(__is_volatile(bool))];
1106   int t37[F(__is_volatile(float))];
1107   int t38[F(__is_volatile(double))];
1108   int t39[F(__is_volatile(long double))];
1109   int t40[F(__is_volatile(unsigned char))];
1110   int t41[F(__is_volatile(unsigned int))];
1111   int t42[F(__is_volatile(unsigned long long))];
1112   int t43[F(__is_volatile(unsigned long))];
1113   int t44[F(__is_volatile(unsigned short))];
1114   int t45[F(__is_volatile(void))];
1115   int t46[F(__is_volatile(ClassType))];
1116   int t47[F(__is_volatile(Derives))];
1117   int t48[F(__is_volatile(Enum))];
1118   int t49[F(__is_volatile(IntArNB))];
1119   int t50[F(__is_volatile(Union))];
1120   int t51[F(__is_volatile(UnionAr))];
1121 }
1122
1123 struct TrivialStruct {
1124   int member;
1125 };
1126
1127 struct NonTrivialStruct {
1128   int member;
1129   NonTrivialStruct() {
1130     member = 0;
1131   }
1132 };
1133
1134 struct SuperNonTrivialStruct {
1135   SuperNonTrivialStruct() { }
1136   ~SuperNonTrivialStruct() { }
1137 };
1138
1139 struct NonTCStruct {
1140   NonTCStruct(const NonTCStruct&) {}
1141 };
1142
1143 struct AllDefaulted {
1144   AllDefaulted() = default;
1145   AllDefaulted(const AllDefaulted &) = default;
1146   AllDefaulted(AllDefaulted &&) = default;
1147   AllDefaulted &operator=(const AllDefaulted &) = default;
1148   AllDefaulted &operator=(AllDefaulted &&) = default;
1149   ~AllDefaulted() = default;
1150 };
1151
1152 struct NoDefaultMoveAssignDueToUDCopyCtor {
1153   NoDefaultMoveAssignDueToUDCopyCtor(const NoDefaultMoveAssignDueToUDCopyCtor&);
1154 };
1155
1156 struct NoDefaultMoveAssignDueToUDCopyAssign {
1157   NoDefaultMoveAssignDueToUDCopyAssign& operator=(
1158     const NoDefaultMoveAssignDueToUDCopyAssign&);
1159 };
1160
1161 struct NoDefaultMoveAssignDueToDtor {
1162   ~NoDefaultMoveAssignDueToDtor();
1163 };
1164
1165 struct AllDeleted {
1166   AllDeleted() = delete;
1167   AllDeleted(const AllDeleted &) = delete;
1168   AllDeleted(AllDeleted &&) = delete;
1169   AllDeleted &operator=(const AllDeleted &) = delete;
1170   AllDeleted &operator=(AllDeleted &&) = delete;
1171   ~AllDeleted() = delete;
1172 };
1173
1174 struct ExtDefaulted {
1175   ExtDefaulted();
1176   ExtDefaulted(const ExtDefaulted &);
1177   ExtDefaulted(ExtDefaulted &&);
1178   ExtDefaulted &operator=(const ExtDefaulted &);
1179   ExtDefaulted &operator=(ExtDefaulted &&);
1180   ~ExtDefaulted();
1181 };
1182
1183 // Despite being defaulted, these functions are not trivial.
1184 ExtDefaulted::ExtDefaulted() = default;
1185 ExtDefaulted::ExtDefaulted(const ExtDefaulted &) = default;
1186 ExtDefaulted::ExtDefaulted(ExtDefaulted &&) = default;
1187 ExtDefaulted &ExtDefaulted::operator=(const ExtDefaulted &) = default;
1188 ExtDefaulted &ExtDefaulted::operator=(ExtDefaulted &&) = default;
1189 ExtDefaulted::~ExtDefaulted() = default;
1190
1191 void is_trivial2()
1192 {
1193   int t01[T(__is_trivial(char))];
1194   int t02[T(__is_trivial(int))];
1195   int t03[T(__is_trivial(long))];
1196   int t04[T(__is_trivial(short))];
1197   int t05[T(__is_trivial(signed char))];
1198   int t06[T(__is_trivial(wchar_t))];
1199   int t07[T(__is_trivial(bool))];
1200   int t08[T(__is_trivial(float))];
1201   int t09[T(__is_trivial(double))];
1202   int t10[T(__is_trivial(long double))];
1203   int t11[T(__is_trivial(unsigned char))];
1204   int t12[T(__is_trivial(unsigned int))];
1205   int t13[T(__is_trivial(unsigned long long))];
1206   int t14[T(__is_trivial(unsigned long))];
1207   int t15[T(__is_trivial(unsigned short))];
1208   int t16[T(__is_trivial(ClassType))];
1209   int t17[T(__is_trivial(Derives))];
1210   int t18[T(__is_trivial(Enum))];
1211   int t19[T(__is_trivial(IntAr))];
1212   int t20[T(__is_trivial(Union))];
1213   int t21[T(__is_trivial(UnionAr))];
1214   int t22[T(__is_trivial(TrivialStruct))];
1215   int t23[T(__is_trivial(AllDefaulted))];
1216   int t24[T(__is_trivial(AllDeleted))];
1217
1218   int t30[F(__is_trivial(void))];
1219   int t31[F(__is_trivial(NonTrivialStruct))];
1220   int t32[F(__is_trivial(SuperNonTrivialStruct))];
1221   int t33[F(__is_trivial(NonTCStruct))];
1222   int t34[F(__is_trivial(ExtDefaulted))];
1223 }
1224
1225 void is_trivially_copyable2()
1226 {
1227   int t01[T(__is_trivially_copyable(char))];
1228   int t02[T(__is_trivially_copyable(int))];
1229   int t03[T(__is_trivially_copyable(long))];
1230   int t04[T(__is_trivially_copyable(short))];
1231   int t05[T(__is_trivially_copyable(signed char))];
1232   int t06[T(__is_trivially_copyable(wchar_t))];
1233   int t07[T(__is_trivially_copyable(bool))];
1234   int t08[T(__is_trivially_copyable(float))];
1235   int t09[T(__is_trivially_copyable(double))];
1236   int t10[T(__is_trivially_copyable(long double))];
1237   int t11[T(__is_trivially_copyable(unsigned char))];
1238   int t12[T(__is_trivially_copyable(unsigned int))];
1239   int t13[T(__is_trivially_copyable(unsigned long long))];
1240   int t14[T(__is_trivially_copyable(unsigned long))];
1241   int t15[T(__is_trivially_copyable(unsigned short))];
1242   int t16[T(__is_trivially_copyable(ClassType))];
1243   int t17[T(__is_trivially_copyable(Derives))];
1244   int t18[T(__is_trivially_copyable(Enum))];
1245   int t19[T(__is_trivially_copyable(IntAr))];
1246   int t20[T(__is_trivially_copyable(Union))];
1247   int t21[T(__is_trivially_copyable(UnionAr))];
1248   int t22[T(__is_trivially_copyable(TrivialStruct))];
1249   int t23[T(__is_trivially_copyable(NonTrivialStruct))];
1250   int t24[T(__is_trivially_copyable(AllDefaulted))];
1251   int t25[T(__is_trivially_copyable(AllDeleted))];
1252
1253   int t30[F(__is_trivially_copyable(void))];
1254   int t31[F(__is_trivially_copyable(SuperNonTrivialStruct))];
1255   int t32[F(__is_trivially_copyable(NonTCStruct))];
1256   int t33[F(__is_trivially_copyable(ExtDefaulted))];
1257
1258   int t34[T(__is_trivially_copyable(const int))];
1259   int t35[F(__is_trivially_copyable(volatile int))];
1260 }
1261
1262 struct CStruct {
1263   int one;
1264   int two;
1265 };
1266
1267 struct CEmptyStruct {};
1268
1269 struct CppEmptyStruct : CStruct {};
1270 struct CppStructStandard : CEmptyStruct {
1271   int three;
1272   int four;
1273 };
1274 struct CppStructNonStandardByBase : CStruct {
1275   int three;
1276   int four;
1277 };
1278 struct CppStructNonStandardByVirt : CStruct {
1279   virtual void method() {}
1280 };
1281 struct CppStructNonStandardByMemb : CStruct {
1282   CppStructNonStandardByVirt member;
1283 };
1284 struct CppStructNonStandardByProt : CStruct {
1285   int five;
1286 protected:
1287   int six;
1288 };
1289 struct CppStructNonStandardByVirtBase : virtual CStruct {
1290 };
1291 struct CppStructNonStandardBySameBase : CEmptyStruct {
1292   CEmptyStruct member;
1293 };
1294 struct CppStructNonStandardBy2ndVirtBase : CEmptyStruct {
1295   CEmptyStruct member;
1296 };
1297
1298 void is_standard_layout()
1299 {
1300   typedef const int ConstInt;
1301   typedef ConstInt ConstIntAr[4];
1302   typedef CppStructStandard CppStructStandardAr[4];
1303
1304   int t01[T(__is_standard_layout(int))];
1305   int t02[T(__is_standard_layout(ConstInt))];
1306   int t03[T(__is_standard_layout(ConstIntAr))];
1307   int t04[T(__is_standard_layout(CStruct))];
1308   int t05[T(__is_standard_layout(CppStructStandard))];
1309   int t06[T(__is_standard_layout(CppStructStandardAr))];
1310   int t07[T(__is_standard_layout(Vector))];
1311   int t08[T(__is_standard_layout(VectorExt))];
1312
1313   typedef CppStructNonStandardByBase CppStructNonStandardByBaseAr[4];
1314
1315   int t10[F(__is_standard_layout(CppStructNonStandardByVirt))];
1316   int t11[F(__is_standard_layout(CppStructNonStandardByMemb))];
1317   int t12[F(__is_standard_layout(CppStructNonStandardByProt))];
1318   int t13[F(__is_standard_layout(CppStructNonStandardByVirtBase))];
1319   int t14[F(__is_standard_layout(CppStructNonStandardByBase))];
1320   int t15[F(__is_standard_layout(CppStructNonStandardByBaseAr))];
1321   int t16[F(__is_standard_layout(CppStructNonStandardBySameBase))];
1322   int t17[F(__is_standard_layout(CppStructNonStandardBy2ndVirtBase))];
1323 }
1324
1325 void is_signed()
1326 {
1327   //int t01[T(__is_signed(char))];
1328   int t02[T(__is_signed(int))];
1329   int t03[T(__is_signed(long))];
1330   int t04[T(__is_signed(short))];
1331   int t05[T(__is_signed(signed char))];
1332   int t06[T(__is_signed(wchar_t))];
1333
1334   int t10[F(__is_signed(bool))];
1335   int t11[F(__is_signed(cvoid))];
1336   int t12[F(__is_signed(float))];
1337   int t13[F(__is_signed(double))];
1338   int t14[F(__is_signed(long double))];
1339   int t15[F(__is_signed(unsigned char))];
1340   int t16[F(__is_signed(unsigned int))];
1341   int t17[F(__is_signed(unsigned long long))];
1342   int t18[F(__is_signed(unsigned long))];
1343   int t19[F(__is_signed(unsigned short))];
1344   int t20[F(__is_signed(void))];
1345   int t21[F(__is_signed(ClassType))];
1346   int t22[F(__is_signed(Derives))];
1347   int t23[F(__is_signed(Enum))];
1348   int t24[F(__is_signed(IntArNB))];
1349   int t25[F(__is_signed(Union))];
1350   int t26[F(__is_signed(UnionAr))];
1351 }
1352
1353 void is_unsigned()
1354 {
1355   int t01[T(__is_unsigned(bool))];
1356   int t02[T(__is_unsigned(unsigned char))];
1357   int t03[T(__is_unsigned(unsigned short))];
1358   int t04[T(__is_unsigned(unsigned int))];
1359   int t05[T(__is_unsigned(unsigned long))];
1360   int t06[T(__is_unsigned(unsigned long long))];
1361   int t07[T(__is_unsigned(Enum))];
1362
1363   int t10[F(__is_unsigned(void))];
1364   int t11[F(__is_unsigned(cvoid))];
1365   int t12[F(__is_unsigned(float))];
1366   int t13[F(__is_unsigned(double))];
1367   int t14[F(__is_unsigned(long double))];
1368   int t16[F(__is_unsigned(char))];
1369   int t17[F(__is_unsigned(signed char))];
1370   int t18[F(__is_unsigned(wchar_t))];
1371   int t19[F(__is_unsigned(short))];
1372   int t20[F(__is_unsigned(int))];
1373   int t21[F(__is_unsigned(long))];
1374   int t22[F(__is_unsigned(Union))];
1375   int t23[F(__is_unsigned(UnionAr))];
1376   int t24[F(__is_unsigned(Derives))];
1377   int t25[F(__is_unsigned(ClassType))];
1378   int t26[F(__is_unsigned(IntArNB))];
1379 }
1380
1381 typedef Int& IntRef;
1382 typedef const IntAr ConstIntAr;
1383 typedef ConstIntAr ConstIntArAr[4];
1384
1385 struct HasCopy {
1386   HasCopy(HasCopy& cp);
1387 };
1388
1389 struct HasMove {
1390   HasMove(HasMove&& cp);
1391 };
1392
1393 struct HasTemplateCons {
1394   HasVirt Annoying;
1395
1396   template <typename T>
1397   HasTemplateCons(const T&);
1398 };
1399
1400 void has_trivial_default_constructor() {
1401   { int arr[T(__has_trivial_constructor(Int))]; }
1402   { int arr[T(__has_trivial_constructor(IntAr))]; }
1403   { int arr[T(__has_trivial_constructor(Union))]; }
1404   { int arr[T(__has_trivial_constructor(UnionAr))]; }
1405   { int arr[T(__has_trivial_constructor(POD))]; }
1406   { int arr[T(__has_trivial_constructor(Derives))]; }
1407   { int arr[T(__has_trivial_constructor(DerivesAr))]; }
1408   { int arr[T(__has_trivial_constructor(ConstIntAr))]; }
1409   { int arr[T(__has_trivial_constructor(ConstIntArAr))]; }
1410   { int arr[T(__has_trivial_constructor(HasDest))]; }
1411   { int arr[T(__has_trivial_constructor(HasPriv))]; }
1412   { int arr[T(__has_trivial_constructor(HasCopyAssign))]; }
1413   { int arr[T(__has_trivial_constructor(HasMoveAssign))]; }
1414   { int arr[T(__has_trivial_constructor(const Int))]; }
1415   { int arr[T(__has_trivial_constructor(AllDefaulted))]; }
1416   { int arr[T(__has_trivial_constructor(AllDeleted))]; }
1417
1418   { int arr[F(__has_trivial_constructor(HasCons))]; }
1419   { int arr[F(__has_trivial_constructor(HasRef))]; }
1420   { int arr[F(__has_trivial_constructor(HasCopy))]; }
1421   { int arr[F(__has_trivial_constructor(IntRef))]; }
1422   { int arr[F(__has_trivial_constructor(VirtAr))]; }
1423   { int arr[F(__has_trivial_constructor(void))]; }
1424   { int arr[F(__has_trivial_constructor(cvoid))]; }
1425   { int arr[F(__has_trivial_constructor(HasTemplateCons))]; }
1426   { int arr[F(__has_trivial_constructor(AllPrivate))]; }
1427   { int arr[F(__has_trivial_constructor(ExtDefaulted))]; }
1428 }
1429
1430 void has_trivial_move_constructor() {
1431   // n3376 12.8 [class.copy]/12
1432   // A copy/move constructor for class X is trivial if it is not
1433   // user-provided, its declared parameter type is the same as
1434   // if it had been implicitly declared, and if
1435   //   - class X has no virtual functions (10.3) and no virtual
1436   //     base classes (10.1), and
1437   //   - the constructor selected to copy/move each direct base
1438   //     class subobject is trivial, and
1439   //   - for each non-static data member of X that is of class
1440   //     type (or array thereof), the constructor selected
1441   //     to copy/move that member is trivial;
1442   // otherwise the copy/move constructor is non-trivial.
1443   { int arr[T(__has_trivial_move_constructor(POD))]; }
1444   { int arr[T(__has_trivial_move_constructor(Union))]; }
1445   { int arr[T(__has_trivial_move_constructor(HasCons))]; }
1446   { int arr[T(__has_trivial_move_constructor(HasStaticMemberMoveCtor))]; }
1447   { int arr[T(__has_trivial_move_constructor(AllDeleted))]; }
1448   
1449   { int arr[F(__has_trivial_move_constructor(HasVirt))]; }
1450   { int arr[F(__has_trivial_move_constructor(DerivesVirt))]; }
1451   { int arr[F(__has_trivial_move_constructor(HasMoveCtor))]; }
1452   { int arr[F(__has_trivial_move_constructor(DerivesHasMoveCtor))]; }
1453   { int arr[F(__has_trivial_move_constructor(HasMemberMoveCtor))]; }
1454 }
1455
1456 void has_trivial_copy_constructor() {
1457   { int arr[T(__has_trivial_copy(Int))]; }
1458   { int arr[T(__has_trivial_copy(IntAr))]; }
1459   { int arr[T(__has_trivial_copy(Union))]; }
1460   { int arr[T(__has_trivial_copy(UnionAr))]; }
1461   { int arr[T(__has_trivial_copy(POD))]; }
1462   { int arr[T(__has_trivial_copy(Derives))]; }
1463   { int arr[T(__has_trivial_copy(ConstIntAr))]; }
1464   { int arr[T(__has_trivial_copy(ConstIntArAr))]; }
1465   { int arr[T(__has_trivial_copy(HasDest))]; }
1466   { int arr[T(__has_trivial_copy(HasPriv))]; }
1467   { int arr[T(__has_trivial_copy(HasCons))]; }
1468   { int arr[T(__has_trivial_copy(HasRef))]; }
1469   { int arr[T(__has_trivial_copy(HasMove))]; }
1470   { int arr[T(__has_trivial_copy(IntRef))]; }
1471   { int arr[T(__has_trivial_copy(HasCopyAssign))]; }
1472   { int arr[T(__has_trivial_copy(HasMoveAssign))]; }
1473   { int arr[T(__has_trivial_copy(const Int))]; }
1474   { int arr[T(__has_trivial_copy(AllDefaulted))]; }
1475   { int arr[T(__has_trivial_copy(AllDeleted))]; }
1476   { int arr[T(__has_trivial_copy(DerivesAr))]; }
1477   { int arr[T(__has_trivial_copy(DerivesHasRef))]; }
1478
1479   { int arr[F(__has_trivial_copy(HasCopy))]; }
1480   { int arr[F(__has_trivial_copy(HasTemplateCons))]; }
1481   { int arr[F(__has_trivial_copy(VirtAr))]; }
1482   { int arr[F(__has_trivial_copy(void))]; }
1483   { int arr[F(__has_trivial_copy(cvoid))]; }
1484   { int arr[F(__has_trivial_copy(AllPrivate))]; }
1485   { int arr[F(__has_trivial_copy(ExtDefaulted))]; }
1486 }
1487
1488 void has_trivial_copy_assignment() {
1489   { int arr[T(__has_trivial_assign(Int))]; }
1490   { int arr[T(__has_trivial_assign(IntAr))]; }
1491   { int arr[T(__has_trivial_assign(Union))]; }
1492   { int arr[T(__has_trivial_assign(UnionAr))]; }
1493   { int arr[T(__has_trivial_assign(POD))]; }
1494   { int arr[T(__has_trivial_assign(Derives))]; }
1495   { int arr[T(__has_trivial_assign(HasDest))]; }
1496   { int arr[T(__has_trivial_assign(HasPriv))]; }
1497   { int arr[T(__has_trivial_assign(HasCons))]; }
1498   { int arr[T(__has_trivial_assign(HasRef))]; }
1499   { int arr[T(__has_trivial_assign(HasCopy))]; }
1500   { int arr[T(__has_trivial_assign(HasMove))]; }
1501   { int arr[T(__has_trivial_assign(HasMoveAssign))]; }
1502   { int arr[T(__has_trivial_assign(AllDefaulted))]; }
1503   { int arr[T(__has_trivial_assign(AllDeleted))]; }
1504   { int arr[T(__has_trivial_assign(DerivesAr))]; }
1505   { int arr[T(__has_trivial_assign(DerivesHasRef))]; }
1506
1507   { int arr[F(__has_trivial_assign(IntRef))]; }
1508   { int arr[F(__has_trivial_assign(HasCopyAssign))]; }
1509   { int arr[F(__has_trivial_assign(const Int))]; }
1510   { int arr[F(__has_trivial_assign(ConstIntAr))]; }
1511   { int arr[F(__has_trivial_assign(ConstIntArAr))]; }
1512   { int arr[F(__has_trivial_assign(VirtAr))]; }
1513   { int arr[F(__has_trivial_assign(void))]; }
1514   { int arr[F(__has_trivial_assign(cvoid))]; }
1515   { int arr[F(__has_trivial_assign(AllPrivate))]; }
1516   { int arr[F(__has_trivial_assign(ExtDefaulted))]; }
1517 }
1518
1519 void has_trivial_destructor() {
1520   { int arr[T(__has_trivial_destructor(Int))]; }
1521   { int arr[T(__has_trivial_destructor(IntAr))]; }
1522   { int arr[T(__has_trivial_destructor(Union))]; }
1523   { int arr[T(__has_trivial_destructor(UnionAr))]; }
1524   { int arr[T(__has_trivial_destructor(POD))]; }
1525   { int arr[T(__has_trivial_destructor(Derives))]; }
1526   { int arr[T(__has_trivial_destructor(ConstIntAr))]; }
1527   { int arr[T(__has_trivial_destructor(ConstIntArAr))]; }
1528   { int arr[T(__has_trivial_destructor(HasPriv))]; }
1529   { int arr[T(__has_trivial_destructor(HasCons))]; }
1530   { int arr[T(__has_trivial_destructor(HasRef))]; }
1531   { int arr[T(__has_trivial_destructor(HasCopy))]; }
1532   { int arr[T(__has_trivial_destructor(HasMove))]; }
1533   { int arr[T(__has_trivial_destructor(IntRef))]; }
1534   { int arr[T(__has_trivial_destructor(HasCopyAssign))]; }
1535   { int arr[T(__has_trivial_destructor(HasMoveAssign))]; }
1536   { int arr[T(__has_trivial_destructor(const Int))]; }
1537   { int arr[T(__has_trivial_destructor(DerivesAr))]; }
1538   { int arr[T(__has_trivial_destructor(VirtAr))]; }
1539   { int arr[T(__has_trivial_destructor(AllDefaulted))]; }
1540   { int arr[T(__has_trivial_destructor(AllDeleted))]; }
1541   { int arr[T(__has_trivial_destructor(DerivesHasRef))]; }
1542
1543   { int arr[F(__has_trivial_destructor(HasDest))]; }
1544   { int arr[F(__has_trivial_destructor(void))]; }
1545   { int arr[F(__has_trivial_destructor(cvoid))]; }
1546   { int arr[F(__has_trivial_destructor(AllPrivate))]; }
1547   { int arr[F(__has_trivial_destructor(ExtDefaulted))]; }
1548 }
1549
1550 struct A { ~A() {} };
1551 template<typename> struct B : A { };
1552
1553 void f() {
1554   { int arr[F(__has_trivial_destructor(A))]; }
1555   { int arr[F(__has_trivial_destructor(B<int>))]; }
1556 }
1557
1558 class PR11110 {
1559   template <int> int operator=( int );
1560   int operator=(PR11110);
1561 };
1562
1563 class UsingAssign;
1564
1565 class UsingAssignBase {
1566 protected:
1567   UsingAssign &operator=(const UsingAssign&) throw();
1568 };
1569
1570 class UsingAssign : public UsingAssignBase {
1571 public:
1572   using UsingAssignBase::operator=;
1573 };
1574
1575 void has_nothrow_assign() {
1576   { int arr[T(__has_nothrow_assign(Int))]; }
1577   { int arr[T(__has_nothrow_assign(IntAr))]; }
1578   { int arr[T(__has_nothrow_assign(Union))]; }
1579   { int arr[T(__has_nothrow_assign(UnionAr))]; }
1580   { int arr[T(__has_nothrow_assign(POD))]; }
1581   { int arr[T(__has_nothrow_assign(Derives))]; }
1582   { int arr[T(__has_nothrow_assign(HasDest))]; }
1583   { int arr[T(__has_nothrow_assign(HasPriv))]; }
1584   { int arr[T(__has_nothrow_assign(HasCons))]; }
1585   { int arr[T(__has_nothrow_assign(HasRef))]; }
1586   { int arr[T(__has_nothrow_assign(HasCopy))]; }
1587   { int arr[T(__has_nothrow_assign(HasMove))]; }
1588   { int arr[T(__has_nothrow_assign(HasMoveAssign))]; }
1589   { int arr[T(__has_nothrow_assign(HasNoThrowCopyAssign))]; }
1590   { int arr[T(__has_nothrow_assign(HasMultipleNoThrowCopyAssign))]; }
1591   { int arr[T(__has_nothrow_assign(HasVirtDest))]; }
1592   { int arr[T(__has_nothrow_assign(AllPrivate))]; }
1593   { int arr[T(__has_nothrow_assign(UsingAssign))]; }
1594   { int arr[T(__has_nothrow_assign(DerivesAr))]; }
1595
1596   { int arr[F(__has_nothrow_assign(IntRef))]; }
1597   { int arr[F(__has_nothrow_assign(HasCopyAssign))]; }
1598   { int arr[F(__has_nothrow_assign(HasMultipleCopyAssign))]; }
1599   { int arr[F(__has_nothrow_assign(const Int))]; }
1600   { int arr[F(__has_nothrow_assign(ConstIntAr))]; }
1601   { int arr[F(__has_nothrow_assign(ConstIntArAr))]; }
1602   { int arr[F(__has_nothrow_assign(VirtAr))]; }
1603   { int arr[F(__has_nothrow_assign(void))]; }
1604   { int arr[F(__has_nothrow_assign(cvoid))]; }
1605   { int arr[F(__has_nothrow_assign(PR11110))]; }
1606 }
1607
1608 void has_nothrow_move_assign() {
1609   { int arr[T(__has_nothrow_move_assign(Int))]; }
1610   { int arr[T(__has_nothrow_move_assign(Enum))]; }
1611   { int arr[T(__has_nothrow_move_assign(Int*))]; }
1612   { int arr[T(__has_nothrow_move_assign(Enum POD::*))]; }
1613   { int arr[T(__has_nothrow_move_assign(POD))]; }
1614   { int arr[T(__has_nothrow_move_assign(HasPriv))]; }
1615   { int arr[T(__has_nothrow_move_assign(HasNoThrowMoveAssign))]; }
1616   { int arr[T(__has_nothrow_move_assign(HasNoExceptNoThrowMoveAssign))]; }
1617   { int arr[T(__has_nothrow_move_assign(HasMemberNoThrowMoveAssign))]; }
1618   { int arr[T(__has_nothrow_move_assign(HasMemberNoExceptNoThrowMoveAssign))]; }
1619   { int arr[T(__has_nothrow_move_assign(AllDeleted))]; }
1620
1621
1622   { int arr[F(__has_nothrow_move_assign(HasThrowMoveAssign))]; }
1623   { int arr[F(__has_nothrow_move_assign(HasNoExceptFalseMoveAssign))]; }
1624   { int arr[F(__has_nothrow_move_assign(HasMemberThrowMoveAssign))]; }
1625   { int arr[F(__has_nothrow_move_assign(HasMemberNoExceptFalseMoveAssign))]; }
1626   { int arr[F(__has_nothrow_move_assign(NoDefaultMoveAssignDueToUDCopyCtor))]; }
1627   { int arr[F(__has_nothrow_move_assign(NoDefaultMoveAssignDueToUDCopyAssign))]; }
1628   { int arr[F(__has_nothrow_move_assign(NoDefaultMoveAssignDueToDtor))]; }
1629
1630
1631   { int arr[T(__is_nothrow_assignable(HasNoThrowMoveAssign, HasNoThrowMoveAssign))]; }
1632   { int arr[F(__is_nothrow_assignable(HasThrowMoveAssign, HasThrowMoveAssign))]; }
1633
1634   { int arr[T(__is_assignable(HasNoThrowMoveAssign, HasNoThrowMoveAssign))]; }
1635   { int arr[T(__is_assignable(HasThrowMoveAssign, HasThrowMoveAssign))]; }
1636 }
1637
1638 void has_trivial_move_assign() {
1639   // n3376 12.8 [class.copy]/25
1640   // A copy/move assignment operator for class X is trivial if it
1641   // is not user-provided, its declared parameter type is the same
1642   // as if it had been implicitly declared, and if:
1643   //  - class X has no virtual functions (10.3) and no virtual base
1644   //    classes (10.1), and
1645   //  - the assignment operator selected to copy/move each direct
1646   //    base class subobject is trivial, and
1647   //  - for each non-static data member of X that is of class type
1648   //    (or array thereof), the assignment operator
1649   //    selected to copy/move that member is trivial;
1650   { int arr[T(__has_trivial_move_assign(Int))]; }
1651   { int arr[T(__has_trivial_move_assign(HasStaticMemberMoveAssign))]; }
1652   { int arr[T(__has_trivial_move_assign(AllDeleted))]; }
1653
1654   { int arr[F(__has_trivial_move_assign(HasVirt))]; }
1655   { int arr[F(__has_trivial_move_assign(DerivesVirt))]; }
1656   { int arr[F(__has_trivial_move_assign(HasMoveAssign))]; }
1657   { int arr[F(__has_trivial_move_assign(DerivesHasMoveAssign))]; }
1658   { int arr[F(__has_trivial_move_assign(HasMemberMoveAssign))]; }
1659   { int arr[F(__has_nothrow_move_assign(NoDefaultMoveAssignDueToUDCopyCtor))]; }
1660   { int arr[F(__has_nothrow_move_assign(NoDefaultMoveAssignDueToUDCopyAssign))]; }
1661 }
1662
1663 void has_nothrow_copy() {
1664   { int arr[T(__has_nothrow_copy(Int))]; }
1665   { int arr[T(__has_nothrow_copy(IntAr))]; }
1666   { int arr[T(__has_nothrow_copy(Union))]; }
1667   { int arr[T(__has_nothrow_copy(UnionAr))]; }
1668   { int arr[T(__has_nothrow_copy(POD))]; }
1669   { int arr[T(__has_nothrow_copy(const Int))]; }
1670   { int arr[T(__has_nothrow_copy(ConstIntAr))]; }
1671   { int arr[T(__has_nothrow_copy(ConstIntArAr))]; }
1672   { int arr[T(__has_nothrow_copy(Derives))]; }
1673   { int arr[T(__has_nothrow_copy(IntRef))]; }
1674   { int arr[T(__has_nothrow_copy(HasDest))]; }
1675   { int arr[T(__has_nothrow_copy(HasPriv))]; }
1676   { int arr[T(__has_nothrow_copy(HasCons))]; }
1677   { int arr[T(__has_nothrow_copy(HasRef))]; }
1678   { int arr[T(__has_nothrow_copy(HasMove))]; }
1679   { int arr[T(__has_nothrow_copy(HasCopyAssign))]; }
1680   { int arr[T(__has_nothrow_copy(HasMoveAssign))]; }
1681   { int arr[T(__has_nothrow_copy(HasNoThrowCopy))]; }
1682   { int arr[T(__has_nothrow_copy(HasMultipleNoThrowCopy))]; }
1683   { int arr[T(__has_nothrow_copy(HasVirtDest))]; }
1684   { int arr[T(__has_nothrow_copy(HasTemplateCons))]; }
1685   { int arr[T(__has_nothrow_copy(AllPrivate))]; }
1686   { int arr[T(__has_nothrow_copy(DerivesAr))]; }
1687
1688   { int arr[F(__has_nothrow_copy(HasCopy))]; }
1689   { int arr[F(__has_nothrow_copy(HasMultipleCopy))]; }
1690   { int arr[F(__has_nothrow_copy(VirtAr))]; }
1691   { int arr[F(__has_nothrow_copy(void))]; }
1692   { int arr[F(__has_nothrow_copy(cvoid))]; }
1693 }
1694
1695 void has_nothrow_constructor() {
1696   { int arr[T(__has_nothrow_constructor(Int))]; }
1697   { int arr[T(__has_nothrow_constructor(IntAr))]; }
1698   { int arr[T(__has_nothrow_constructor(Union))]; }
1699   { int arr[T(__has_nothrow_constructor(UnionAr))]; }
1700   { int arr[T(__has_nothrow_constructor(POD))]; }
1701   { int arr[T(__has_nothrow_constructor(Derives))]; }
1702   { int arr[T(__has_nothrow_constructor(DerivesAr))]; }
1703   { int arr[T(__has_nothrow_constructor(ConstIntAr))]; }
1704   { int arr[T(__has_nothrow_constructor(ConstIntArAr))]; }
1705   { int arr[T(__has_nothrow_constructor(HasDest))]; }
1706   { int arr[T(__has_nothrow_constructor(HasPriv))]; }
1707   { int arr[T(__has_nothrow_constructor(HasCopyAssign))]; }
1708   { int arr[T(__has_nothrow_constructor(const Int))]; }
1709   { int arr[T(__has_nothrow_constructor(HasNoThrowConstructor))]; }
1710   { int arr[T(__has_nothrow_constructor(HasVirtDest))]; }
1711   // { int arr[T(__has_nothrow_constructor(VirtAr))]; } // not implemented
1712   { int arr[T(__has_nothrow_constructor(AllPrivate))]; }
1713
1714   { int arr[F(__has_nothrow_constructor(HasCons))]; }
1715   { int arr[F(__has_nothrow_constructor(HasRef))]; }
1716   { int arr[F(__has_nothrow_constructor(HasCopy))]; }
1717   { int arr[F(__has_nothrow_constructor(HasMove))]; }
1718   { int arr[F(__has_nothrow_constructor(HasNoThrowConstructorWithArgs))]; }
1719   { int arr[F(__has_nothrow_constructor(IntRef))]; }
1720   { int arr[F(__has_nothrow_constructor(void))]; }
1721   { int arr[F(__has_nothrow_constructor(cvoid))]; }
1722   { int arr[F(__has_nothrow_constructor(HasTemplateCons))]; }
1723
1724   { int arr[F(__has_nothrow_constructor(HasMultipleDefaultConstructor1))]; }
1725   { int arr[F(__has_nothrow_constructor(HasMultipleDefaultConstructor2))]; }
1726 }
1727
1728 void has_virtual_destructor() {
1729   { int arr[F(__has_virtual_destructor(Int))]; }
1730   { int arr[F(__has_virtual_destructor(IntAr))]; }
1731   { int arr[F(__has_virtual_destructor(Union))]; }
1732   { int arr[F(__has_virtual_destructor(UnionAr))]; }
1733   { int arr[F(__has_virtual_destructor(POD))]; }
1734   { int arr[F(__has_virtual_destructor(Derives))]; }
1735   { int arr[F(__has_virtual_destructor(DerivesAr))]; }
1736   { int arr[F(__has_virtual_destructor(const Int))]; }
1737   { int arr[F(__has_virtual_destructor(ConstIntAr))]; }
1738   { int arr[F(__has_virtual_destructor(ConstIntArAr))]; }
1739   { int arr[F(__has_virtual_destructor(HasDest))]; }
1740   { int arr[F(__has_virtual_destructor(HasPriv))]; }
1741   { int arr[F(__has_virtual_destructor(HasCons))]; }
1742   { int arr[F(__has_virtual_destructor(HasRef))]; }
1743   { int arr[F(__has_virtual_destructor(HasCopy))]; }
1744   { int arr[F(__has_virtual_destructor(HasMove))]; }
1745   { int arr[F(__has_virtual_destructor(HasCopyAssign))]; }
1746   { int arr[F(__has_virtual_destructor(HasMoveAssign))]; }
1747   { int arr[F(__has_virtual_destructor(IntRef))]; }
1748   { int arr[F(__has_virtual_destructor(VirtAr))]; }
1749
1750   { int arr[T(__has_virtual_destructor(HasVirtDest))]; }
1751   { int arr[T(__has_virtual_destructor(DerivedVirtDest))]; }
1752   { int arr[F(__has_virtual_destructor(VirtDestAr))]; }
1753   { int arr[F(__has_virtual_destructor(void))]; }
1754   { int arr[F(__has_virtual_destructor(cvoid))]; }
1755   { int arr[F(__has_virtual_destructor(AllPrivate))]; }
1756 }
1757
1758
1759 class Base {};
1760 class Derived : Base {};
1761 class Derived2a : Derived {};
1762 class Derived2b : Derived {};
1763 class Derived3 : virtual Derived2a, virtual Derived2b {};
1764 template<typename T> struct BaseA { T a;  };
1765 template<typename T> struct DerivedB : BaseA<T> { };
1766 template<typename T> struct CrazyDerived : T { };
1767
1768
1769 class class_forward; // expected-note 2 {{forward declaration of 'class_forward'}}
1770
1771 template <typename Base, typename Derived>
1772 void isBaseOfT() {
1773   int t[T(__is_base_of(Base, Derived))];
1774 };
1775 template <typename Base, typename Derived>
1776 void isBaseOfF() {
1777   int t[F(__is_base_of(Base, Derived))];
1778 };
1779
1780 template <class T> class DerivedTemp : Base {};
1781 template <class T> class NonderivedTemp {};
1782 template <class T> class UndefinedTemp; // expected-note {{declared here}}
1783
1784 void is_base_of() {
1785   { int arr[T(__is_base_of(Base, Derived))]; }
1786   { int arr[T(__is_base_of(const Base, Derived))]; }
1787   { int arr[F(__is_base_of(Derived, Base))]; }
1788   { int arr[F(__is_base_of(Derived, int))]; }
1789   { int arr[T(__is_base_of(Base, Base))]; }
1790   { int arr[T(__is_base_of(Base, Derived3))]; }
1791   { int arr[T(__is_base_of(Derived, Derived3))]; }
1792   { int arr[T(__is_base_of(Derived2b, Derived3))]; }
1793   { int arr[T(__is_base_of(Derived2a, Derived3))]; }
1794   { int arr[T(__is_base_of(BaseA<int>, DerivedB<int>))]; }
1795   { int arr[F(__is_base_of(DerivedB<int>, BaseA<int>))]; }
1796   { int arr[T(__is_base_of(Base, CrazyDerived<Base>))]; }
1797   { int arr[F(__is_base_of(Union, Union))]; }
1798   { int arr[T(__is_base_of(Empty, Empty))]; }
1799   { int arr[T(__is_base_of(class_forward, class_forward))]; }
1800   { int arr[F(__is_base_of(Empty, class_forward))]; } // expected-error {{incomplete type 'class_forward' used in type trait expression}}
1801   { int arr[F(__is_base_of(Base&, Derived&))]; }
1802   int t18[F(__is_base_of(Base[10], Derived[10]))];
1803   { int arr[F(__is_base_of(int, int))]; }
1804   { int arr[F(__is_base_of(long, int))]; }
1805   { int arr[T(__is_base_of(Base, DerivedTemp<int>))]; }
1806   { int arr[F(__is_base_of(Base, NonderivedTemp<int>))]; }
1807   { int arr[F(__is_base_of(Base, UndefinedTemp<int>))]; } // expected-error {{implicit instantiation of undefined template 'UndefinedTemp<int>'}}
1808
1809   isBaseOfT<Base, Derived>();
1810   isBaseOfF<Derived, Base>();
1811
1812   isBaseOfT<Base, CrazyDerived<Base> >();
1813   isBaseOfF<CrazyDerived<Base>, Base>();
1814
1815   isBaseOfT<BaseA<int>, DerivedB<int> >();
1816   isBaseOfF<DerivedB<int>, BaseA<int> >();
1817 }
1818
1819 template<class T, class U>
1820 class TemplateClass {};
1821
1822 template<class T>
1823 using TemplateAlias = TemplateClass<T, int>;
1824
1825 typedef class Base BaseTypedef;
1826
1827 void is_same()
1828 {
1829   int t01[T(__is_same(Base, Base))];
1830   int t02[T(__is_same(Base, BaseTypedef))];
1831   int t03[T(__is_same(TemplateClass<int, int>, TemplateAlias<int>))];
1832
1833   int t10[F(__is_same(Base, const Base))];
1834   int t11[F(__is_same(Base, Base&))];
1835   int t12[F(__is_same(Base, Derived))];
1836 }
1837
1838 struct IntWrapper
1839 {
1840   int value;
1841   IntWrapper(int _value) : value(_value) {}
1842   operator int() const {
1843     return value;
1844   }
1845 };
1846
1847 struct FloatWrapper
1848 {
1849   float value;
1850   FloatWrapper(float _value) : value(_value) {}
1851   FloatWrapper(const IntWrapper& obj)
1852     : value(static_cast<float>(obj.value)) {}
1853   operator float() const {
1854     return value;
1855   }
1856   operator IntWrapper() const {
1857     return IntWrapper(static_cast<int>(value));
1858   }
1859 };
1860
1861 void is_convertible()
1862 {
1863   int t01[T(__is_convertible(IntWrapper, IntWrapper))];
1864   int t02[T(__is_convertible(IntWrapper, const IntWrapper))];
1865   int t03[T(__is_convertible(IntWrapper, int))];
1866   int t04[T(__is_convertible(int, IntWrapper))];
1867   int t05[T(__is_convertible(IntWrapper, FloatWrapper))];
1868   int t06[T(__is_convertible(FloatWrapper, IntWrapper))];
1869   int t07[T(__is_convertible(FloatWrapper, float))];
1870   int t08[T(__is_convertible(float, FloatWrapper))];
1871 }
1872
1873 struct FromInt { FromInt(int); };
1874 struct ToInt { operator int(); };
1875 typedef void Function();
1876
1877 void is_convertible_to();
1878 class PrivateCopy {
1879   PrivateCopy(const PrivateCopy&);
1880   friend void is_convertible_to();
1881 };
1882
1883 template<typename T>
1884 struct X0 { 
1885   template<typename U> X0(const X0<U>&);
1886 };
1887
1888 struct Abstract { virtual void f() = 0; };
1889
1890 void is_convertible_to() {
1891   { int arr[T(__is_convertible_to(Int, Int))]; }
1892   { int arr[F(__is_convertible_to(Int, IntAr))]; }
1893   { int arr[F(__is_convertible_to(IntAr, IntAr))]; }
1894   { int arr[T(__is_convertible_to(void, void))]; }
1895   { int arr[T(__is_convertible_to(cvoid, void))]; }
1896   { int arr[T(__is_convertible_to(void, cvoid))]; }
1897   { int arr[T(__is_convertible_to(cvoid, cvoid))]; }
1898   { int arr[T(__is_convertible_to(int, FromInt))]; }
1899   { int arr[T(__is_convertible_to(long, FromInt))]; }
1900   { int arr[T(__is_convertible_to(double, FromInt))]; }
1901   { int arr[T(__is_convertible_to(const int, FromInt))]; }
1902   { int arr[T(__is_convertible_to(const int&, FromInt))]; }
1903   { int arr[T(__is_convertible_to(ToInt, int))]; }
1904   { int arr[T(__is_convertible_to(ToInt, const int&))]; }
1905   { int arr[T(__is_convertible_to(ToInt, long))]; }
1906   { int arr[F(__is_convertible_to(ToInt, int&))]; }
1907   { int arr[F(__is_convertible_to(ToInt, FromInt))]; }
1908   { int arr[T(__is_convertible_to(IntAr&, IntAr&))]; }
1909   { int arr[T(__is_convertible_to(IntAr&, const IntAr&))]; }
1910   { int arr[F(__is_convertible_to(const IntAr&, IntAr&))]; }
1911   { int arr[F(__is_convertible_to(Function, Function))]; }
1912   { int arr[F(__is_convertible_to(PrivateCopy, PrivateCopy))]; }
1913   { int arr[T(__is_convertible_to(X0<int>, X0<float>))]; }
1914   { int arr[F(__is_convertible_to(Abstract, Abstract))]; }
1915 }
1916
1917 namespace is_convertible_to_instantiate {
1918   // Make sure we don't try to instantiate the constructor.
1919   template<int x> class A { A(int) { int a[x]; } };
1920   int x = __is_convertible_to(int, A<-1>);
1921 }
1922
1923 void is_trivial()
1924 {
1925   { int arr[T(__is_trivial(int))]; }
1926   { int arr[T(__is_trivial(Enum))]; }
1927   { int arr[T(__is_trivial(POD))]; }
1928   { int arr[T(__is_trivial(Int))]; }
1929   { int arr[T(__is_trivial(IntAr))]; }
1930   { int arr[T(__is_trivial(IntArNB))]; }
1931   { int arr[T(__is_trivial(Statics))]; }
1932   { int arr[T(__is_trivial(Empty))]; }
1933   { int arr[T(__is_trivial(EmptyUnion))]; }
1934   { int arr[T(__is_trivial(Union))]; }
1935   { int arr[T(__is_trivial(Derives))]; }
1936   { int arr[T(__is_trivial(DerivesAr))]; }
1937   { int arr[T(__is_trivial(DerivesArNB))]; }
1938   { int arr[T(__is_trivial(DerivesEmpty))]; }
1939   { int arr[T(__is_trivial(HasFunc))]; }
1940   { int arr[T(__is_trivial(HasOp))]; }
1941   { int arr[T(__is_trivial(HasConv))]; }
1942   { int arr[T(__is_trivial(HasAssign))]; }
1943   { int arr[T(__is_trivial(HasAnonymousUnion))]; }
1944   { int arr[T(__is_trivial(HasPriv))]; }
1945   { int arr[T(__is_trivial(HasProt))]; }
1946   { int arr[T(__is_trivial(DerivesHasPriv))]; }
1947   { int arr[T(__is_trivial(DerivesHasProt))]; }
1948   { int arr[T(__is_trivial(Vector))]; }
1949   { int arr[T(__is_trivial(VectorExt))]; }
1950
1951   { int arr[F(__is_trivial(HasCons))]; }
1952   { int arr[F(__is_trivial(HasCopyAssign))]; }
1953   { int arr[F(__is_trivial(HasMoveAssign))]; }
1954   { int arr[F(__is_trivial(HasDest))]; }
1955   { int arr[F(__is_trivial(HasRef))]; }
1956   { int arr[F(__is_trivial(HasNonPOD))]; }
1957   { int arr[F(__is_trivial(HasVirt))]; }
1958   { int arr[F(__is_trivial(DerivesHasCons))]; }
1959   { int arr[F(__is_trivial(DerivesHasCopyAssign))]; }
1960   { int arr[F(__is_trivial(DerivesHasMoveAssign))]; }
1961   { int arr[F(__is_trivial(DerivesHasDest))]; }
1962   { int arr[F(__is_trivial(DerivesHasRef))]; }
1963   { int arr[F(__is_trivial(DerivesHasVirt))]; }
1964   { int arr[F(__is_trivial(void))]; }
1965   { int arr[F(__is_trivial(cvoid))]; }
1966 }
1967
1968 template<typename T> struct TriviallyConstructibleTemplate {};
1969
1970 void trivial_checks()
1971 {
1972   { int arr[T(__is_trivially_copyable(int))]; }
1973   { int arr[T(__is_trivially_copyable(Enum))]; }
1974   { int arr[T(__is_trivially_copyable(POD))]; }
1975   { int arr[T(__is_trivially_copyable(Int))]; }
1976   { int arr[T(__is_trivially_copyable(IntAr))]; }
1977   { int arr[T(__is_trivially_copyable(IntArNB))]; }
1978   { int arr[T(__is_trivially_copyable(Statics))]; }
1979   { int arr[T(__is_trivially_copyable(Empty))]; }
1980   { int arr[T(__is_trivially_copyable(EmptyUnion))]; }
1981   { int arr[T(__is_trivially_copyable(Union))]; }
1982   { int arr[T(__is_trivially_copyable(Derives))]; }
1983   { int arr[T(__is_trivially_copyable(DerivesAr))]; }
1984   { int arr[T(__is_trivially_copyable(DerivesArNB))]; }
1985   { int arr[T(__is_trivially_copyable(DerivesEmpty))]; }
1986   { int arr[T(__is_trivially_copyable(HasFunc))]; }
1987   { int arr[T(__is_trivially_copyable(HasOp))]; }
1988   { int arr[T(__is_trivially_copyable(HasConv))]; }
1989   { int arr[T(__is_trivially_copyable(HasAssign))]; }
1990   { int arr[T(__is_trivially_copyable(HasAnonymousUnion))]; }
1991   { int arr[T(__is_trivially_copyable(HasPriv))]; }
1992   { int arr[T(__is_trivially_copyable(HasProt))]; }
1993   { int arr[T(__is_trivially_copyable(DerivesHasPriv))]; }
1994   { int arr[T(__is_trivially_copyable(DerivesHasProt))]; }
1995   { int arr[T(__is_trivially_copyable(Vector))]; }
1996   { int arr[T(__is_trivially_copyable(VectorExt))]; }
1997   { int arr[T(__is_trivially_copyable(HasCons))]; }
1998   { int arr[T(__is_trivially_copyable(HasRef))]; }
1999   { int arr[T(__is_trivially_copyable(HasNonPOD))]; }
2000   { int arr[T(__is_trivially_copyable(DerivesHasCons))]; }
2001   { int arr[T(__is_trivially_copyable(DerivesHasRef))]; }
2002   { int arr[T(__is_trivially_copyable(NonTrivialDefault))]; }
2003   { int arr[T(__is_trivially_copyable(NonTrivialDefault[]))]; }
2004   { int arr[T(__is_trivially_copyable(NonTrivialDefault[3]))]; }
2005
2006   { int arr[F(__is_trivially_copyable(HasCopyAssign))]; }
2007   { int arr[F(__is_trivially_copyable(HasMoveAssign))]; }
2008   { int arr[F(__is_trivially_copyable(HasDest))]; }
2009   { int arr[F(__is_trivially_copyable(HasVirt))]; }
2010   { int arr[F(__is_trivially_copyable(DerivesHasCopyAssign))]; }
2011   { int arr[F(__is_trivially_copyable(DerivesHasMoveAssign))]; }
2012   { int arr[F(__is_trivially_copyable(DerivesHasDest))]; }
2013   { int arr[F(__is_trivially_copyable(DerivesHasVirt))]; }
2014   { int arr[F(__is_trivially_copyable(void))]; }
2015   { int arr[F(__is_trivially_copyable(cvoid))]; }
2016
2017   { int arr[T((__is_trivially_constructible(int)))]; }
2018   { int arr[T((__is_trivially_constructible(int, int)))]; }
2019   { int arr[T((__is_trivially_constructible(int, float)))]; }
2020   { int arr[T((__is_trivially_constructible(int, int&)))]; }
2021   { int arr[T((__is_trivially_constructible(int, const int&)))]; }
2022   { int arr[T((__is_trivially_constructible(int, int)))]; }
2023   { int arr[T((__is_trivially_constructible(HasCopyAssign, HasCopyAssign)))]; }
2024   { int arr[T((__is_trivially_constructible(HasCopyAssign, const HasCopyAssign&)))]; }
2025   { int arr[T((__is_trivially_constructible(HasCopyAssign, HasCopyAssign&&)))]; }
2026   { int arr[T((__is_trivially_constructible(HasCopyAssign)))]; }
2027   { int arr[T((__is_trivially_constructible(NonTrivialDefault,
2028                                             const NonTrivialDefault&)))]; }
2029   { int arr[T((__is_trivially_constructible(NonTrivialDefault,
2030                                             NonTrivialDefault&&)))]; }
2031   { int arr[T((__is_trivially_constructible(AllDefaulted)))]; }
2032   { int arr[T((__is_trivially_constructible(AllDefaulted,
2033                                             const AllDefaulted &)))]; }
2034   { int arr[T((__is_trivially_constructible(AllDefaulted,
2035                                             AllDefaulted &&)))]; }
2036
2037   { int arr[F((__is_trivially_constructible(int, int*)))]; }
2038   { int arr[F((__is_trivially_constructible(NonTrivialDefault)))]; }
2039   { int arr[F((__is_trivially_constructible(ThreeArgCtor, int*, char*, int&)))]; }
2040   { int arr[F((__is_trivially_constructible(AllDeleted)))]; }
2041   { int arr[F((__is_trivially_constructible(AllDeleted,
2042                                             const AllDeleted &)))]; }
2043   { int arr[F((__is_trivially_constructible(AllDeleted,
2044                                             AllDeleted &&)))]; }
2045   { int arr[F((__is_trivially_constructible(ExtDefaulted)))]; }
2046   { int arr[F((__is_trivially_constructible(ExtDefaulted,
2047                                             const ExtDefaulted &)))]; }
2048   { int arr[F((__is_trivially_constructible(ExtDefaulted,
2049                                             ExtDefaulted &&)))]; }
2050
2051   { int arr[T((__is_trivially_constructible(TriviallyConstructibleTemplate<int>)))]; }
2052   { int arr[F((__is_trivially_constructible(class_forward)))]; } // expected-error {{incomplete type 'class_forward' used in type trait expression}}
2053   { int arr[F((__is_trivially_constructible(class_forward[])))]; }
2054   { int arr[F((__is_trivially_constructible(void)))]; }
2055
2056   { int arr[T((__is_trivially_assignable(int&, int)))]; }
2057   { int arr[T((__is_trivially_assignable(int&, int&)))]; }
2058   { int arr[T((__is_trivially_assignable(int&, int&&)))]; }
2059   { int arr[T((__is_trivially_assignable(int&, const int&)))]; }
2060   { int arr[T((__is_trivially_assignable(POD&, POD)))]; }
2061   { int arr[T((__is_trivially_assignable(POD&, POD&)))]; }
2062   { int arr[T((__is_trivially_assignable(POD&, POD&&)))]; }
2063   { int arr[T((__is_trivially_assignable(POD&, const POD&)))]; }
2064   { int arr[T((__is_trivially_assignable(int*&, int*)))]; }
2065   { int arr[T((__is_trivially_assignable(AllDefaulted,
2066                                          const AllDefaulted &)))]; }
2067   { int arr[T((__is_trivially_assignable(AllDefaulted,
2068                                          AllDefaulted &&)))]; }
2069
2070   { int arr[F((__is_trivially_assignable(int*&, float*)))]; }
2071   { int arr[F((__is_trivially_assignable(HasCopyAssign&, HasCopyAssign)))]; }
2072   { int arr[F((__is_trivially_assignable(HasCopyAssign&, HasCopyAssign&)))]; }
2073   { int arr[F((__is_trivially_assignable(HasCopyAssign&, const HasCopyAssign&)))]; }
2074   { int arr[F((__is_trivially_assignable(HasCopyAssign&, HasCopyAssign&&)))]; }
2075   { int arr[F((__is_trivially_assignable(TrivialMoveButNotCopy&,
2076                                         TrivialMoveButNotCopy&)))]; }
2077   { int arr[F((__is_trivially_assignable(TrivialMoveButNotCopy&,
2078                                         const TrivialMoveButNotCopy&)))]; }
2079   { int arr[F((__is_trivially_assignable(AllDeleted,
2080                                          const AllDeleted &)))]; }
2081   { int arr[F((__is_trivially_assignable(AllDeleted,
2082                                          AllDeleted &&)))]; }
2083   { int arr[F((__is_trivially_assignable(ExtDefaulted,
2084                                          const ExtDefaulted &)))]; }
2085   { int arr[F((__is_trivially_assignable(ExtDefaulted,
2086                                          ExtDefaulted &&)))]; }
2087
2088   { int arr[T((__is_trivially_assignable(HasDefaultTrivialCopyAssign&,
2089                                          HasDefaultTrivialCopyAssign&)))]; }
2090   { int arr[T((__is_trivially_assignable(HasDefaultTrivialCopyAssign&,
2091                                        const HasDefaultTrivialCopyAssign&)))]; }
2092   { int arr[T((__is_trivially_assignable(TrivialMoveButNotCopy&,
2093                                          TrivialMoveButNotCopy)))]; }
2094   { int arr[T((__is_trivially_assignable(TrivialMoveButNotCopy&,
2095                                          TrivialMoveButNotCopy&&)))]; }
2096   { int arr[T((__is_trivially_assignable(int&, int)))]; }
2097   { int arr[T((__is_trivially_assignable(int&, int&)))]; }
2098   { int arr[T((__is_trivially_assignable(int&, int&&)))]; }
2099   { int arr[T((__is_trivially_assignable(int&, const int&)))]; }
2100   { int arr[T((__is_trivially_assignable(POD&, POD)))]; }
2101   { int arr[T((__is_trivially_assignable(POD&, POD&)))]; }
2102   { int arr[T((__is_trivially_assignable(POD&, POD&&)))]; }
2103   { int arr[T((__is_trivially_assignable(POD&, const POD&)))]; }
2104   { int arr[T((__is_trivially_assignable(int*&, int*)))]; }
2105   { int arr[T((__is_trivially_assignable(AllDefaulted,
2106                                          const AllDefaulted &)))]; }
2107   { int arr[T((__is_trivially_assignable(AllDefaulted,
2108                                          AllDefaulted &&)))]; }
2109
2110   { int arr[F((__is_assignable(int *&, float *)))]; }
2111   { int arr[T((__is_assignable(HasCopyAssign &, HasCopyAssign)))]; }
2112   { int arr[T((__is_assignable(HasCopyAssign &, HasCopyAssign &)))]; }
2113   { int arr[T((__is_assignable(HasCopyAssign &, const HasCopyAssign &)))]; }
2114   { int arr[T((__is_assignable(HasCopyAssign &, HasCopyAssign &&)))]; }
2115   { int arr[T((__is_assignable(TrivialMoveButNotCopy &,
2116                                TrivialMoveButNotCopy &)))]; }
2117   { int arr[T((__is_assignable(TrivialMoveButNotCopy &,
2118                                const TrivialMoveButNotCopy &)))]; }
2119   { int arr[F((__is_assignable(AllDeleted,
2120                                const AllDeleted &)))]; }
2121   { int arr[F((__is_assignable(AllDeleted,
2122                                AllDeleted &&)))]; }
2123   { int arr[T((__is_assignable(ExtDefaulted,
2124                                const ExtDefaulted &)))]; }
2125   { int arr[T((__is_assignable(ExtDefaulted,
2126                                ExtDefaulted &&)))]; }
2127
2128   { int arr[T((__is_assignable(HasDefaultTrivialCopyAssign &,
2129                                HasDefaultTrivialCopyAssign &)))]; }
2130   { int arr[T((__is_assignable(HasDefaultTrivialCopyAssign &,
2131                                const HasDefaultTrivialCopyAssign &)))]; }
2132   { int arr[T((__is_assignable(TrivialMoveButNotCopy &,
2133                                TrivialMoveButNotCopy)))]; }
2134   { int arr[T((__is_assignable(TrivialMoveButNotCopy &,
2135                                TrivialMoveButNotCopy &&)))]; }
2136 }
2137
2138 void constructible_checks() {
2139   { int arr[T(__is_constructible(HasNoThrowConstructorWithArgs))]; }
2140   { int arr[F(__is_nothrow_constructible(HasNoThrowConstructorWithArgs))]; } // MSVC doesn't look into default args and gets this wrong.
2141
2142   { int arr[T(__is_constructible(HasNoThrowConstructorWithArgs, HasCons))]; }
2143   { int arr[T(__is_nothrow_constructible(HasNoThrowConstructorWithArgs, HasCons))]; }
2144
2145   { int arr[T(__is_constructible(NonTrivialDefault))]; }
2146   { int arr[F(__is_nothrow_constructible(NonTrivialDefault))]; }
2147
2148   { int arr[T(__is_constructible(int))]; }
2149   { int arr[T(__is_nothrow_constructible(int))]; }
2150
2151   { int arr[F(__is_constructible(NonPOD))]; }
2152   { int arr[F(__is_nothrow_constructible(NonPOD))]; }
2153
2154   { int arr[T(__is_constructible(NonPOD, int))]; }
2155   { int arr[F(__is_nothrow_constructible(NonPOD, int))]; }
2156
2157   // PR19178
2158   { int arr[F(__is_constructible(Abstract))]; }
2159   { int arr[F(__is_nothrow_constructible(Abstract))]; }
2160
2161   // PR20228
2162   { int arr[T(__is_constructible(VariadicCtor,
2163                                  int, int, int, int, int, int, int, int, int))]; }
2164
2165   // PR25513
2166   { int arr[F(__is_constructible(int(int)))]; }
2167 }
2168
2169 // Instantiation of __is_trivially_constructible
2170 template<typename T, typename ...Args>
2171 struct is_trivially_constructible {
2172   static const bool value = __is_trivially_constructible(T, Args...);
2173 };
2174
2175 void is_trivially_constructible_test() {
2176   { int arr[T((is_trivially_constructible<int>::value))]; }
2177   { int arr[T((is_trivially_constructible<int, int>::value))]; }
2178   { int arr[T((is_trivially_constructible<int, float>::value))]; }
2179   { int arr[T((is_trivially_constructible<int, int&>::value))]; }
2180   { int arr[T((is_trivially_constructible<int, const int&>::value))]; }
2181   { int arr[T((is_trivially_constructible<int, int>::value))]; }
2182   { int arr[T((is_trivially_constructible<HasCopyAssign, HasCopyAssign>::value))]; }
2183   { int arr[T((is_trivially_constructible<HasCopyAssign, const HasCopyAssign&>::value))]; }
2184   { int arr[T((is_trivially_constructible<HasCopyAssign, HasCopyAssign&&>::value))]; }
2185   { int arr[T((is_trivially_constructible<HasCopyAssign>::value))]; }
2186   { int arr[T((is_trivially_constructible<NonTrivialDefault,
2187                                             const NonTrivialDefault&>::value))]; }
2188   { int arr[T((is_trivially_constructible<NonTrivialDefault,
2189                                             NonTrivialDefault&&>::value))]; }
2190
2191   { int arr[F((is_trivially_constructible<int, int*>::value))]; }
2192   { int arr[F((is_trivially_constructible<NonTrivialDefault>::value))]; }
2193   { int arr[F((is_trivially_constructible<ThreeArgCtor, int*, char*, int&>::value))]; }
2194   { int arr[F((is_trivially_constructible<Abstract>::value))]; } // PR19178
2195 }
2196
2197 void array_rank() {
2198   int t01[T(__array_rank(IntAr) == 1)];
2199   int t02[T(__array_rank(ConstIntArAr) == 2)];
2200 }
2201
2202 void array_extent() {
2203   int t01[T(__array_extent(IntAr, 0) == 10)];
2204   int t02[T(__array_extent(ConstIntArAr, 0) == 4)];
2205   int t03[T(__array_extent(ConstIntArAr, 1) == 10)];
2206 }
2207
2208 void is_destructible_test() {
2209   { int arr[T(__is_destructible(int))]; }
2210   { int arr[T(__is_destructible(int[2]))]; }
2211   { int arr[F(__is_destructible(int[]))]; }
2212   { int arr[F(__is_destructible(void))]; }
2213   { int arr[T(__is_destructible(int &))]; }
2214   { int arr[T(__is_destructible(HasDest))]; }
2215   { int arr[F(__is_destructible(AllPrivate))]; }
2216   { int arr[T(__is_destructible(SuperNonTrivialStruct))]; }
2217   { int arr[T(__is_destructible(AllDefaulted))]; }
2218   { int arr[F(__is_destructible(AllDeleted))]; }
2219   { int arr[T(__is_destructible(ThrowingDtor))]; }
2220   { int arr[T(__is_destructible(NoThrowDtor))]; }
2221 }
2222
2223 void is_nothrow_destructible_test() {
2224   { int arr[T(__is_nothrow_destructible(int))]; }
2225   { int arr[T(__is_nothrow_destructible(int[2]))]; }
2226   { int arr[F(__is_nothrow_destructible(int[]))]; }
2227   { int arr[F(__is_nothrow_destructible(void))]; }
2228   { int arr[T(__is_nothrow_destructible(int &))]; }
2229   { int arr[T(__is_nothrow_destructible(HasDest))]; }
2230   { int arr[F(__is_nothrow_destructible(AllPrivate))]; }
2231   { int arr[T(__is_nothrow_destructible(SuperNonTrivialStruct))]; }
2232   { int arr[T(__is_nothrow_destructible(AllDefaulted))]; }
2233   { int arr[F(__is_nothrow_destructible(AllDeleted))]; }
2234   { int arr[F(__is_nothrow_destructible(ThrowingDtor))]; }
2235   { int arr[T(__is_nothrow_destructible(NoExceptDtor))]; }
2236   { int arr[T(__is_nothrow_destructible(NoThrowDtor))]; }
2237 }