ast-dump-special-member-functions.cpp 21.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
// Test without serialization:
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++17 -ast-dump %s \
// RUN: | FileCheck -strict-whitespace %s
//
// Test with serialization:
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++17 -emit-pch -o %t %s
// RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -std=c++17 -include-pch %t -ast-dump-all /dev/null \
// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
// RUN: | FileCheck -strict-whitespace %s

// FIXME: exists

struct TrivialDefaultConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <{{.*}}:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialDefaultConstructor definition
  // CHECK: DefaultConstructor {{.*}} trivial{{.*}}
  TrivialDefaultConstructor() = default;
};

struct NontrivialDefaultConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialDefaultConstructor definition
  // CHECK: DefaultConstructor {{.*}}non_trivial{{.*}}
  NontrivialDefaultConstructor() {}
};

struct UserProvidedDefaultConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserProvidedDefaultConstructor definition
  // CHECK: DefaultConstructor {{.*}}user_provided{{.*}}
  UserProvidedDefaultConstructor() {}
};

struct NonUserProvidedDefaultConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserProvidedDefaultConstructor definition
  // CHECK-NOT: DefaultConstructor {{.*}}user_provided{{.*}}
};

struct HasConstexprDefaultConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasConstexprDefaultConstructor definition
  // CHECK: DefaultConstructor {{.*}}constexpr{{.*}}
  constexpr HasConstexprDefaultConstructor() {}
};

struct DoesNotHaveConstexprDefaultConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotHaveConstexprDefaultConstructor definition
  // CHECK-NOT: DefaultConstructor {{.*}} constexpr{{.*}}
  DoesNotHaveConstexprDefaultConstructor() {}
};

struct NeedsImplicitDefaultConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitDefaultConstructor definition
  // CHECK: DefaultConstructor {{.*}}needs_implicit{{.*}}
  int i = 12;
};

struct DoesNotNeedImplicitDefaultConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitDefaultConstructor definition
  // CHECK-NOT: DefaultConstructor {{.*}}needs_implicit{{.*}}
  DoesNotNeedImplicitDefaultConstructor() {}
};

struct DefaultedDefaultConstructorIsConstexpr {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DefaultedDefaultConstructorIsConstexpr definition
  // CHECK: DefaultConstructor {{.*}}defaulted_is_constexpr{{.*}}
  DefaultedDefaultConstructorIsConstexpr() = default;
};

struct DefaultedDefaultConstructorIsNotConstexpr {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+6]]:1> line:[[@LINE-1]]:8 struct DefaultedDefaultConstructorIsNotConstexpr definition
  // CHECK-NOT: DefaultConstructor {{.*}}defaulted_is_constexpr{{.*}}
  DefaultedDefaultConstructorIsNotConstexpr() = default;
  union {
    int i;
  };
};

struct SimpleCopyConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct SimpleCopyConstructor definition
  // CHECK: CopyConstructor {{.*}}simple{{.*}}
  int i = 12;
};

struct NotSimpleCopyConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NotSimpleCopyConstructor definition
  // CHECK-NOT: CopyConstructor {{.*}}simple{{.*}}
  NotSimpleCopyConstructor(const NotSimpleCopyConstructor&) = delete;
};

struct TrivialCopyConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialCopyConstructor definition
  // CHECK: CopyConstructor {{.*}} trivial{{.*}}
  TrivialCopyConstructor() = default;
};

struct NontrivialCopyConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialCopyConstructor definition
  // CHECK: CopyConstructor {{.*}}non_trivial{{.*}}
  NontrivialCopyConstructor(const NontrivialCopyConstructor&) {}
};

struct UserDeclaredCopyConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredCopyConstructor definition
  // CHECK: CopyConstructor {{.*}}user_declared{{.*}}
  UserDeclaredCopyConstructor(const UserDeclaredCopyConstructor&) {}
};

struct NonUserDeclaredCopyConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredCopyConstructor definition
  // CHECK-NOT: CopyConstructor {{.*}}user_declared{{.*}}
};

struct CopyConstructorHasConstParam {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyConstructorHasConstParam definition
  // CHECK: CopyConstructor {{.*}}has_const_param{{.*}}
  CopyConstructorHasConstParam(const CopyConstructorHasConstParam&) {}
};

struct CopyConstructorDoesNotHaveConstParam {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyConstructorDoesNotHaveConstParam definition
  // CHECK-NOT: CopyConstructor {{.*}} has_const_param{{.*}}
  CopyConstructorDoesNotHaveConstParam(CopyConstructorDoesNotHaveConstParam&) {}
};

struct NeedsImplicitCopyConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitCopyConstructor definition
  // CHECK: CopyConstructor {{.*}}needs_implicit{{.*}}
  int i = 12;
};

struct DoesNotNeedImplicitCopyConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitCopyConstructor definition
  // CHECK-NOT: CopyConstructor {{.*}}needs_implicit{{.*}}
  DoesNotNeedImplicitCopyConstructor(const DoesNotNeedImplicitCopyConstructor&) {}
};

struct DeletedDestructor {
private:
  ~DeletedDestructor() = delete;
};

struct CopyConstructorNeedsOverloadResolution : virtual DeletedDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct CopyConstructorNeedsOverloadResolution definition
  // CHECK: CopyConstructor {{.*}}needs_overload_resolution{{.*}}
};

struct CopyConstructorDoesNotNeedOverloadResolution {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct CopyConstructorDoesNotNeedOverloadResolution definition
  // CHECK-NOT: CopyConstructor {{.*}}needs_overload_resolution{{.*}}
};

struct DefaultedCopyConstructorIsDeleted {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+4]]:1> line:[[@LINE-1]]:8 struct DefaultedCopyConstructorIsDeleted definition
  // CHECK: CopyConstructor {{.*}}defaulted_is_deleted{{.*}}
  int &&i;
  DefaultedCopyConstructorIsDeleted(const DefaultedCopyConstructorIsDeleted&) = default;
};

struct DefaultedCopyConstructorIsNotDeleted {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+4]]:1> line:[[@LINE-1]]:8 struct DefaultedCopyConstructorIsNotDeleted definition
  // CHECK-NOT: CopyConstructor {{.*}}defaulted_is_deleted{{.*}}
  int i;
  DefaultedCopyConstructorIsNotDeleted(const DefaultedCopyConstructorIsNotDeleted&) = default;
};

struct BaseWithoutCopyConstructorConstParam {
  BaseWithoutCopyConstructorConstParam(BaseWithoutCopyConstructorConstParam&);
};

struct ImplicitCopyConstructorHasConstParam {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct ImplicitCopyConstructorHasConstParam definition
  // CHECK: CopyConstructor {{.*}}implicit_has_const_param{{.*}}
};

struct ImplicitCopyConstructorDoesNotHaveConstParam : BaseWithoutCopyConstructorConstParam {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct ImplicitCopyConstructorDoesNotHaveConstParam definition
  // CHECK-NOT: CopyConstructor {{.*}}implicit_has_const_param{{.*}}
};

struct MoveConstructorExists {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveConstructorExists definition
  // CHECK: MoveConstructor {{.*}}exists{{.*}}
};

struct MoveConstructorDoesNotExist {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct MoveConstructorDoesNotExist definition
  // CHECK-NOT: MoveConstructor {{.*}}exists{{.*}}
  MoveConstructorDoesNotExist(const MoveConstructorDoesNotExist&);
};

struct SimpleMoveConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct SimpleMoveConstructor definition
  // CHECK: MoveConstructor {{.*}}simple{{.*}}
  int i = 12;
};

struct NotSimpleMoveConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NotSimpleMoveConstructor definition
  // CHECK-NOT: MoveConstructor {{.*}}simple{{.*}}
  NotSimpleMoveConstructor(NotSimpleMoveConstructor&&) = delete;
};

struct TrivialMoveConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialMoveConstructor definition
  // CHECK: MoveConstructor {{.*}} trivial{{.*}}
  TrivialMoveConstructor() = default;
};

struct NontrivialMoveConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialMoveConstructor definition
  // CHECK: MoveConstructor {{.*}}non_trivial{{.*}}
  NontrivialMoveConstructor(NontrivialMoveConstructor&&) {}
};

struct UserDeclaredMoveConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredMoveConstructor definition
  // CHECK: MoveConstructor {{.*}}user_declared{{.*}}
  UserDeclaredMoveConstructor(UserDeclaredMoveConstructor&&) {}
};

struct NonUserDeclaredMoveConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredMoveConstructor definition
  // CHECK-NOT: MoveConstructor {{.*}}user_declared{{.*}}
};

struct NeedsImplicitMoveConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitMoveConstructor definition
  // CHECK: MoveConstructor {{.*}}needs_implicit{{.*}}
  int i = 12;
};

struct DoesNotNeedImplicitMoveConstructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitMoveConstructor definition
  // CHECK-NOT: MoveConstructor {{.*}}needs_implicit{{.*}}
  DoesNotNeedImplicitMoveConstructor(DoesNotNeedImplicitMoveConstructor&&) {}
};

struct MoveConstructorNeedsOverloadResolution : virtual DeletedDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveConstructorNeedsOverloadResolution definition
  // CHECK: MoveConstructor {{.*}}needs_overload_resolution{{.*}}
};

struct MoveConstructorDoesNotNeedOverloadResolution {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveConstructorDoesNotNeedOverloadResolution definition
  // CHECK-NOT: MoveConstructor {{.*}}needs_overload_resolution{{.*}}
};

// FIXME: defaulted_is_deleted

struct TrivialCopyAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialCopyAssignment definition
  // CHECK: CopyAssignment {{.*}} trivial{{.*}}
  TrivialCopyAssignment& operator=(const TrivialCopyAssignment&) = default;
};

struct NontrivialCopyAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialCopyAssignment definition
  // CHECK: CopyAssignment {{.*}}non_trivial{{.*}}
  NontrivialCopyAssignment& operator=(const NontrivialCopyAssignment&) {}
};

struct CopyAssignmentHasConstParam {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentHasConstParam definition
  // CHECK: CopyAssignment {{.*}}has_const_param{{.*}}
  CopyAssignmentHasConstParam& operator=(const CopyAssignmentHasConstParam&) {}
};

struct CopyAssignmentDoesNotHaveConstParam {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentDoesNotHaveConstParam definition
  // CHECK-NOT: CopyAssignment {{.*}} has_const_param{{.*}}
  CopyAssignmentDoesNotHaveConstParam& operator=(CopyAssignmentDoesNotHaveConstParam&) {}
};

struct UserDeclaredCopyAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredCopyAssignment definition
  // CHECK: CopyAssignment {{.*}}user_declared{{.*}}
  UserDeclaredCopyAssignment& operator=(const UserDeclaredCopyAssignment&) {}
};

struct NonUserDeclaredCopyAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredCopyAssignment definition
  // CHECK-NOT: CopyAssignment {{.*}}user_declared{{.*}}
};

struct NeedsImplicitCopyAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitCopyAssignment definition
  // CHECK: CopyAssignment {{.*}}needs_implicit{{.*}}
  int i = 12;
};

struct DoesNotNeedImplicitCopyAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitCopyAssignment definition
  // CHECK-NOT: CopyAssignment {{.*}}needs_implicit{{.*}}
  DoesNotNeedImplicitCopyAssignment& operator=(const DoesNotNeedImplicitCopyAssignment&) {}
};

struct DeclaresCopyAssignment {
  DeclaresCopyAssignment &operator=(const DeclaresCopyAssignment&) &;
};

struct CopyAssignmentNeedsOverloadResolution {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentNeedsOverloadResolution definition
  // CHECK: CopyAssignment {{.*}}needs_overload_resolution{{.*}}
  DeclaresCopyAssignment i;
};

struct CopyAssignmentDoesNotNeedOverloadResolution {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentDoesNotNeedOverloadResolution definition
  // CHECK-NOT: CopyAssignment {{.*}}needs_overload_resolution{{.*}}
};

struct BaseWithoutCopyAssignmentConstParam {
  BaseWithoutCopyAssignmentConstParam& operator=(BaseWithoutCopyAssignmentConstParam&);
};

struct ImplicitCopyAssignmentHasConstParam {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct ImplicitCopyAssignmentHasConstParam definition
  // CHECK: CopyAssignment {{.*}}implicit_has_const_param{{.*}}
};

struct ImplicitCopyAssignmentDoesNotHaveConstParam : BaseWithoutCopyAssignmentConstParam {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct ImplicitCopyAssignmentDoesNotHaveConstParam definition
  // CHECK-NOT: CopyAssignment {{.*}}implicit_has_const_param{{.*}}
};

struct MoveAssignmentExists {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveAssignmentExists definition
  // CHECK: MoveAssignment {{.*}}exists{{.*}}
};

struct MoveAssignmentDoesNotExist {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct MoveAssignmentDoesNotExist definition
  // CHECK-NOT: MoveAssignment {{.*}}exists{{.*}}
  MoveAssignmentDoesNotExist& operator=(const MoveAssignmentDoesNotExist&);
};

struct SimpleMoveAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct SimpleMoveAssignment definition
  // CHECK: MoveAssignment {{.*}}simple{{.*}}
  int i = 12;
};

struct NotSimpleMoveAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NotSimpleMoveAssignment definition
  // CHECK-NOT: MoveAssignment {{.*}}simple{{.*}}
  NotSimpleMoveAssignment& operator=(NotSimpleMoveAssignment&&) = delete;
};

struct TrivialMoveAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialMoveAssignment definition
  // CHECK: MoveAssignment {{.*}} trivial{{.*}}
  TrivialMoveAssignment() = default;
};

struct NontrivialMoveAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialMoveAssignment definition
  // CHECK: MoveAssignment {{.*}}non_trivial{{.*}}
  NontrivialMoveAssignment& operator=(NontrivialMoveAssignment&&) {}
};

struct UserDeclaredMoveAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredMoveAssignment definition
  // CHECK: MoveAssignment {{.*}}user_declared{{.*}}
  UserDeclaredMoveAssignment& operator=(UserDeclaredMoveAssignment&&) {}
};

struct NonUserDeclaredMoveAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredMoveAssignment definition
  // CHECK-NOT: MoveAssignment {{.*}}user_declared{{.*}}
};

struct NeedsImplicitMoveAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitMoveAssignment definition
  // CHECK: MoveAssignment {{.*}}needs_implicit{{.*}}
  int i = 12;
};

struct DoesNotNeedImplicitMoveAssignment {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitMoveAssignment definition
  // CHECK-NOT: MoveAssignment {{.*}}needs_implicit{{.*}}
  DoesNotNeedImplicitMoveAssignment& operator=(DoesNotNeedImplicitMoveAssignment&&) {}
};

struct MoveAssignmentNeedsOverloadResolution : virtual DeletedDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveAssignmentNeedsOverloadResolution definition
  // CHECK: MoveAssignment {{.*}}needs_overload_resolution{{.*}}
};

struct MoveAssignmentDoesNotNeedOverloadResolution {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveAssignmentDoesNotNeedOverloadResolution definition
  // CHECK-NOT: MoveAssignment {{.*}}needs_overload_resolution{{.*}}
};

struct SimpleDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct SimpleDestructor definition
  // CHECK: Destructor {{.*}}simple{{.*}}
};

struct NotSimpleDestructor : DeletedDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NotSimpleDestructor definition
  // CHECK-NOT: Destructor {{.*}}simple{{.*}}
};

struct IrrelevantDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct IrrelevantDestructor definition
  // CHECK: Destructor {{.*}}irrelevant{{.*}}
};

struct RelevantDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct RelevantDestructor definition
  // CHECK-NOT: Destructor {{.*}}irrelevant{{.*}}
  ~RelevantDestructor() {}
};

struct TrivialDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialDestructor definition
  // CHECK: Destructor {{.*}} trivial{{.*}}
  ~TrivialDestructor() = default;
};

struct NontrivialDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialDestructor definition
  // CHECK: Destructor {{.*}}non_trivial{{.*}}
  ~NontrivialDestructor() {}
};

struct UserDeclaredDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredDestructor definition
  // CHECK: Destructor {{.*}}user_declared{{.*}}
  ~UserDeclaredDestructor() {}
};

struct NonUserDeclaredDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredDestructor definition
  // CHECK-NOT: Destructor {{.*}}user_declared{{.*}}
};

struct NeedsImplicitDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitDestructor definition
  // CHECK: Destructor {{.*}}needs_implicit{{.*}}
  int i = 12;
};

struct DoesNotNeedImplicitDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitDestructor definition
  // CHECK-NOT: Destructor {{.*}}needs_implicit{{.*}}
  ~DoesNotNeedImplicitDestructor() {}
};

struct DestructorNeedsOverloadResolution : virtual DeletedDestructor {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DestructorNeedsOverloadResolution definition
  // CHECK: Destructor {{.*}}needs_overload_resolution{{.*}}
  ~DestructorNeedsOverloadResolution();
};

struct DestructorDoesNotNeedOverloadResolution {
  // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct DestructorDoesNotNeedOverloadResolution definition
  // CHECK-NOT: Destructor {{.*}}needs_overload_resolution{{.*}}
};

// FIXME: defaulted_is_deleted