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