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