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