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