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