| 1 | // RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++17 -ast-dump %s | FileCheck -strict-whitespace %s |
| 2 | |
| 3 | // FIXME: exists |
| 4 | |
| 5 | struct TrivialDefaultConstructor { |
| 6 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <{{.*}}:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialDefaultConstructor definition |
| 7 | // CHECK: DefaultConstructor {{.*}} trivial{{.*}} |
| 8 | TrivialDefaultConstructor() = default; |
| 9 | }; |
| 10 | |
| 11 | struct NontrivialDefaultConstructor { |
| 12 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialDefaultConstructor definition |
| 13 | // CHECK: DefaultConstructor {{.*}}non_trivial{{.*}} |
| 14 | NontrivialDefaultConstructor() {} |
| 15 | }; |
| 16 | |
| 17 | struct UserProvidedDefaultConstructor { |
| 18 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserProvidedDefaultConstructor definition |
| 19 | // CHECK: DefaultConstructor {{.*}}user_provided{{.*}} |
| 20 | UserProvidedDefaultConstructor() {} |
| 21 | }; |
| 22 | |
| 23 | struct NonUserProvidedDefaultConstructor { |
| 24 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserProvidedDefaultConstructor definition |
| 25 | // CHECK-NOT: DefaultConstructor {{.*}}user_provided{{.*}} |
| 26 | }; |
| 27 | |
| 28 | struct HasConstexprDefaultConstructor { |
| 29 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasConstexprDefaultConstructor definition |
| 30 | // CHECK: DefaultConstructor {{.*}}constexpr{{.*}} |
| 31 | constexpr HasConstexprDefaultConstructor() {} |
| 32 | }; |
| 33 | |
| 34 | struct DoesNotHaveConstexprDefaultConstructor { |
| 35 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotHaveConstexprDefaultConstructor definition |
| 36 | // CHECK-NOT: DefaultConstructor {{.*}} constexpr{{.*}} |
| 37 | DoesNotHaveConstexprDefaultConstructor() {} |
| 38 | }; |
| 39 | |
| 40 | struct NeedsImplicitDefaultConstructor { |
| 41 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitDefaultConstructor definition |
| 42 | // CHECK: DefaultConstructor {{.*}}needs_implicit{{.*}} |
| 43 | int i = 12; |
| 44 | }; |
| 45 | |
| 46 | struct DoesNotNeedImplicitDefaultConstructor { |
| 47 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitDefaultConstructor definition |
| 48 | // CHECK-NOT: DefaultConstructor {{.*}}needs_implicit{{.*}} |
| 49 | DoesNotNeedImplicitDefaultConstructor() {} |
| 50 | }; |
| 51 | |
| 52 | struct DefaultedDefaultConstructorIsConstexpr { |
| 53 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DefaultedDefaultConstructorIsConstexpr definition |
| 54 | // CHECK: DefaultConstructor {{.*}}defaulted_is_constexpr{{.*}} |
| 55 | DefaultedDefaultConstructorIsConstexpr() = default; |
| 56 | }; |
| 57 | |
| 58 | struct DefaultedDefaultConstructorIsNotConstexpr { |
| 59 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+6]]:1> line:[[@LINE-1]]:8 struct DefaultedDefaultConstructorIsNotConstexpr definition |
| 60 | // CHECK-NOT: DefaultConstructor {{.*}}defaulted_is_constexpr{{.*}} |
| 61 | DefaultedDefaultConstructorIsNotConstexpr() = default; |
| 62 | union { |
| 63 | int i; |
| 64 | }; |
| 65 | }; |
| 66 | |
| 67 | struct SimpleCopyConstructor { |
| 68 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct SimpleCopyConstructor definition |
| 69 | // CHECK: CopyConstructor {{.*}}simple{{.*}} |
| 70 | int i = 12; |
| 71 | }; |
| 72 | |
| 73 | struct NotSimpleCopyConstructor { |
| 74 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NotSimpleCopyConstructor definition |
| 75 | // CHECK-NOT: CopyConstructor {{.*}}simple{{.*}} |
| 76 | NotSimpleCopyConstructor(const NotSimpleCopyConstructor&) = delete; |
| 77 | }; |
| 78 | |
| 79 | struct TrivialCopyConstructor { |
| 80 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialCopyConstructor definition |
| 81 | // CHECK: CopyConstructor {{.*}} trivial{{.*}} |
| 82 | TrivialCopyConstructor() = default; |
| 83 | }; |
| 84 | |
| 85 | struct NontrivialCopyConstructor { |
| 86 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialCopyConstructor definition |
| 87 | // CHECK: CopyConstructor {{.*}}non_trivial{{.*}} |
| 88 | NontrivialCopyConstructor(const NontrivialCopyConstructor&) {} |
| 89 | }; |
| 90 | |
| 91 | struct UserDeclaredCopyConstructor { |
| 92 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredCopyConstructor definition |
| 93 | // CHECK: CopyConstructor {{.*}}user_declared{{.*}} |
| 94 | UserDeclaredCopyConstructor(const UserDeclaredCopyConstructor&) {} |
| 95 | }; |
| 96 | |
| 97 | struct NonUserDeclaredCopyConstructor { |
| 98 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredCopyConstructor definition |
| 99 | // CHECK-NOT: CopyConstructor {{.*}}user_declared{{.*}} |
| 100 | }; |
| 101 | |
| 102 | struct CopyConstructorHasConstParam { |
| 103 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyConstructorHasConstParam definition |
| 104 | // CHECK: CopyConstructor {{.*}}has_const_param{{.*}} |
| 105 | CopyConstructorHasConstParam(const CopyConstructorHasConstParam&) {} |
| 106 | }; |
| 107 | |
| 108 | struct CopyConstructorDoesNotHaveConstParam { |
| 109 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyConstructorDoesNotHaveConstParam definition |
| 110 | // CHECK-NOT: CopyConstructor {{.*}} has_const_param{{.*}} |
| 111 | CopyConstructorDoesNotHaveConstParam(CopyConstructorDoesNotHaveConstParam&) {} |
| 112 | }; |
| 113 | |
| 114 | struct NeedsImplicitCopyConstructor { |
| 115 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitCopyConstructor definition |
| 116 | // CHECK: CopyConstructor {{.*}}needs_implicit{{.*}} |
| 117 | int i = 12; |
| 118 | }; |
| 119 | |
| 120 | struct DoesNotNeedImplicitCopyConstructor { |
| 121 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitCopyConstructor definition |
| 122 | // CHECK-NOT: CopyConstructor {{.*}}needs_implicit{{.*}} |
| 123 | DoesNotNeedImplicitCopyConstructor(const DoesNotNeedImplicitCopyConstructor&) {} |
| 124 | }; |
| 125 | |
| 126 | struct DeletedDestructor { |
| 127 | private: |
| 128 | ~DeletedDestructor() = delete; |
| 129 | }; |
| 130 | |
| 131 | struct CopyConstructorNeedsOverloadResolution : virtual DeletedDestructor { |
| 132 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct CopyConstructorNeedsOverloadResolution definition |
| 133 | // CHECK: CopyConstructor {{.*}}needs_overload_resolution{{.*}} |
| 134 | }; |
| 135 | |
| 136 | struct CopyConstructorDoesNotNeedOverloadResolution { |
| 137 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct CopyConstructorDoesNotNeedOverloadResolution definition |
| 138 | // CHECK-NOT: CopyConstructor {{.*}}needs_overload_resolution{{.*}} |
| 139 | }; |
| 140 | |
| 141 | struct DefaultedCopyConstructorIsDeleted { |
| 142 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+4]]:1> line:[[@LINE-1]]:8 struct DefaultedCopyConstructorIsDeleted definition |
| 143 | // CHECK: CopyConstructor {{.*}}defaulted_is_deleted{{.*}} |
| 144 | int &&i; |
| 145 | DefaultedCopyConstructorIsDeleted(const DefaultedCopyConstructorIsDeleted&) = default; |
| 146 | }; |
| 147 | |
| 148 | struct DefaultedCopyConstructorIsNotDeleted { |
| 149 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+4]]:1> line:[[@LINE-1]]:8 struct DefaultedCopyConstructorIsNotDeleted definition |
| 150 | // CHECK-NOT: CopyConstructor {{.*}}defaulted_is_deleted{{.*}} |
| 151 | int i; |
| 152 | DefaultedCopyConstructorIsNotDeleted(const DefaultedCopyConstructorIsNotDeleted&) = default; |
| 153 | }; |
| 154 | |
| 155 | struct BaseWithoutCopyConstructorConstParam { |
| 156 | BaseWithoutCopyConstructorConstParam(BaseWithoutCopyConstructorConstParam&); |
| 157 | }; |
| 158 | |
| 159 | struct ImplicitCopyConstructorHasConstParam { |
| 160 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct ImplicitCopyConstructorHasConstParam definition |
| 161 | // CHECK: CopyConstructor {{.*}}implicit_has_const_param{{.*}} |
| 162 | }; |
| 163 | |
| 164 | struct ImplicitCopyConstructorDoesNotHaveConstParam : BaseWithoutCopyConstructorConstParam { |
| 165 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct ImplicitCopyConstructorDoesNotHaveConstParam definition |
| 166 | // CHECK-NOT: CopyConstructor {{.*}}implicit_has_const_param{{.*}} |
| 167 | }; |
| 168 | |
| 169 | struct MoveConstructorExists { |
| 170 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveConstructorExists definition |
| 171 | // CHECK: MoveConstructor {{.*}}exists{{.*}} |
| 172 | }; |
| 173 | |
| 174 | struct MoveConstructorDoesNotExist { |
| 175 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct MoveConstructorDoesNotExist definition |
| 176 | // CHECK-NOT: MoveConstructor {{.*}}exists{{.*}} |
| 177 | MoveConstructorDoesNotExist(const MoveConstructorDoesNotExist&); |
| 178 | }; |
| 179 | |
| 180 | struct SimpleMoveConstructor { |
| 181 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct SimpleMoveConstructor definition |
| 182 | // CHECK: MoveConstructor {{.*}}simple{{.*}} |
| 183 | int i = 12; |
| 184 | }; |
| 185 | |
| 186 | struct NotSimpleMoveConstructor { |
| 187 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NotSimpleMoveConstructor definition |
| 188 | // CHECK-NOT: MoveConstructor {{.*}}simple{{.*}} |
| 189 | NotSimpleMoveConstructor(NotSimpleMoveConstructor&&) = delete; |
| 190 | }; |
| 191 | |
| 192 | struct TrivialMoveConstructor { |
| 193 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialMoveConstructor definition |
| 194 | // CHECK: MoveConstructor {{.*}} trivial{{.*}} |
| 195 | TrivialMoveConstructor() = default; |
| 196 | }; |
| 197 | |
| 198 | struct NontrivialMoveConstructor { |
| 199 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialMoveConstructor definition |
| 200 | // CHECK: MoveConstructor {{.*}}non_trivial{{.*}} |
| 201 | NontrivialMoveConstructor(NontrivialMoveConstructor&&) {} |
| 202 | }; |
| 203 | |
| 204 | struct UserDeclaredMoveConstructor { |
| 205 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredMoveConstructor definition |
| 206 | // CHECK: MoveConstructor {{.*}}user_declared{{.*}} |
| 207 | UserDeclaredMoveConstructor(UserDeclaredMoveConstructor&&) {} |
| 208 | }; |
| 209 | |
| 210 | struct NonUserDeclaredMoveConstructor { |
| 211 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredMoveConstructor definition |
| 212 | // CHECK-NOT: MoveConstructor {{.*}}user_declared{{.*}} |
| 213 | }; |
| 214 | |
| 215 | struct NeedsImplicitMoveConstructor { |
| 216 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitMoveConstructor definition |
| 217 | // CHECK: MoveConstructor {{.*}}needs_implicit{{.*}} |
| 218 | int i = 12; |
| 219 | }; |
| 220 | |
| 221 | struct DoesNotNeedImplicitMoveConstructor { |
| 222 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitMoveConstructor definition |
| 223 | // CHECK-NOT: MoveConstructor {{.*}}needs_implicit{{.*}} |
| 224 | DoesNotNeedImplicitMoveConstructor(DoesNotNeedImplicitMoveConstructor&&) {} |
| 225 | }; |
| 226 | |
| 227 | struct MoveConstructorNeedsOverloadResolution : virtual DeletedDestructor { |
| 228 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveConstructorNeedsOverloadResolution definition |
| 229 | // CHECK: MoveConstructor {{.*}}needs_overload_resolution{{.*}} |
| 230 | }; |
| 231 | |
| 232 | struct MoveConstructorDoesNotNeedOverloadResolution { |
| 233 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveConstructorDoesNotNeedOverloadResolution definition |
| 234 | // CHECK-NOT: MoveConstructor {{.*}}needs_overload_resolution{{.*}} |
| 235 | }; |
| 236 | |
| 237 | // FIXME: defaulted_is_deleted |
| 238 | |
| 239 | struct TrivialCopyAssignment { |
| 240 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialCopyAssignment definition |
| 241 | // CHECK: CopyAssignment {{.*}} trivial{{.*}} |
| 242 | TrivialCopyAssignment& operator=(const TrivialCopyAssignment&) = default; |
| 243 | }; |
| 244 | |
| 245 | struct NontrivialCopyAssignment { |
| 246 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialCopyAssignment definition |
| 247 | // CHECK: CopyAssignment {{.*}}non_trivial{{.*}} |
| 248 | NontrivialCopyAssignment& operator=(const NontrivialCopyAssignment&) {} |
| 249 | }; |
| 250 | |
| 251 | struct CopyAssignmentHasConstParam { |
| 252 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentHasConstParam definition |
| 253 | // CHECK: CopyAssignment {{.*}}has_const_param{{.*}} |
| 254 | CopyAssignmentHasConstParam& operator=(const CopyAssignmentHasConstParam&) {} |
| 255 | }; |
| 256 | |
| 257 | struct CopyAssignmentDoesNotHaveConstParam { |
| 258 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentDoesNotHaveConstParam definition |
| 259 | // CHECK-NOT: CopyAssignment {{.*}} has_const_param{{.*}} |
| 260 | CopyAssignmentDoesNotHaveConstParam& operator=(CopyAssignmentDoesNotHaveConstParam&) {} |
| 261 | }; |
| 262 | |
| 263 | struct UserDeclaredCopyAssignment { |
| 264 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredCopyAssignment definition |
| 265 | // CHECK: CopyAssignment {{.*}}user_declared{{.*}} |
| 266 | UserDeclaredCopyAssignment& operator=(const UserDeclaredCopyAssignment&) {} |
| 267 | }; |
| 268 | |
| 269 | struct NonUserDeclaredCopyAssignment { |
| 270 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredCopyAssignment definition |
| 271 | // CHECK-NOT: CopyAssignment {{.*}}user_declared{{.*}} |
| 272 | }; |
| 273 | |
| 274 | struct NeedsImplicitCopyAssignment { |
| 275 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitCopyAssignment definition |
| 276 | // CHECK: CopyAssignment {{.*}}needs_implicit{{.*}} |
| 277 | int i = 12; |
| 278 | }; |
| 279 | |
| 280 | struct DoesNotNeedImplicitCopyAssignment { |
| 281 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitCopyAssignment definition |
| 282 | // CHECK-NOT: CopyAssignment {{.*}}needs_implicit{{.*}} |
| 283 | DoesNotNeedImplicitCopyAssignment& operator=(const DoesNotNeedImplicitCopyAssignment&) {} |
| 284 | }; |
| 285 | |
| 286 | struct CopyAssignmentNeedsOverloadResolution { |
| 287 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentNeedsOverloadResolution definition |
| 288 | // CHECK: CopyAssignment {{.*}}needs_overload_resolution{{.*}} |
| 289 | mutable int i; |
| 290 | }; |
| 291 | |
| 292 | struct CopyAssignmentDoesNotNeedOverloadResolution { |
| 293 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentDoesNotNeedOverloadResolution definition |
| 294 | // CHECK-NOT: CopyAssignment {{.*}}needs_overload_resolution{{.*}} |
| 295 | }; |
| 296 | |
| 297 | struct BaseWithoutCopyAssignmentConstParam { |
| 298 | BaseWithoutCopyAssignmentConstParam& operator=(BaseWithoutCopyAssignmentConstParam&); |
| 299 | }; |
| 300 | |
| 301 | struct ImplicitCopyAssignmentHasConstParam { |
| 302 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct ImplicitCopyAssignmentHasConstParam definition |
| 303 | // CHECK: CopyAssignment {{.*}}implicit_has_const_param{{.*}} |
| 304 | }; |
| 305 | |
| 306 | struct ImplicitCopyAssignmentDoesNotHaveConstParam : BaseWithoutCopyAssignmentConstParam { |
| 307 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct ImplicitCopyAssignmentDoesNotHaveConstParam definition |
| 308 | // CHECK-NOT: CopyAssignment {{.*}}implicit_has_const_param{{.*}} |
| 309 | }; |
| 310 | |
| 311 | struct MoveAssignmentExists { |
| 312 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveAssignmentExists definition |
| 313 | // CHECK: MoveAssignment {{.*}}exists{{.*}} |
| 314 | }; |
| 315 | |
| 316 | struct MoveAssignmentDoesNotExist { |
| 317 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct MoveAssignmentDoesNotExist definition |
| 318 | // CHECK-NOT: MoveAssignment {{.*}}exists{{.*}} |
| 319 | MoveAssignmentDoesNotExist& operator=(const MoveAssignmentDoesNotExist&); |
| 320 | }; |
| 321 | |
| 322 | struct SimpleMoveAssignment { |
| 323 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct SimpleMoveAssignment definition |
| 324 | // CHECK: MoveAssignment {{.*}}simple{{.*}} |
| 325 | int i = 12; |
| 326 | }; |
| 327 | |
| 328 | struct NotSimpleMoveAssignment { |
| 329 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NotSimpleMoveAssignment definition |
| 330 | // CHECK-NOT: MoveAssignment {{.*}}simple{{.*}} |
| 331 | NotSimpleMoveAssignment& operator=(NotSimpleMoveAssignment&&) = delete; |
| 332 | }; |
| 333 | |
| 334 | struct TrivialMoveAssignment { |
| 335 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialMoveAssignment definition |
| 336 | // CHECK: MoveAssignment {{.*}} trivial{{.*}} |
| 337 | TrivialMoveAssignment() = default; |
| 338 | }; |
| 339 | |
| 340 | struct NontrivialMoveAssignment { |
| 341 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialMoveAssignment definition |
| 342 | // CHECK: MoveAssignment {{.*}}non_trivial{{.*}} |
| 343 | NontrivialMoveAssignment& operator=(NontrivialMoveAssignment&&) {} |
| 344 | }; |
| 345 | |
| 346 | struct UserDeclaredMoveAssignment { |
| 347 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredMoveAssignment definition |
| 348 | // CHECK: MoveAssignment {{.*}}user_declared{{.*}} |
| 349 | UserDeclaredMoveAssignment& operator=(UserDeclaredMoveAssignment&&) {} |
| 350 | }; |
| 351 | |
| 352 | struct NonUserDeclaredMoveAssignment { |
| 353 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredMoveAssignment definition |
| 354 | // CHECK-NOT: MoveAssignment {{.*}}user_declared{{.*}} |
| 355 | }; |
| 356 | |
| 357 | struct NeedsImplicitMoveAssignment { |
| 358 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitMoveAssignment definition |
| 359 | // CHECK: MoveAssignment {{.*}}needs_implicit{{.*}} |
| 360 | int i = 12; |
| 361 | }; |
| 362 | |
| 363 | struct DoesNotNeedImplicitMoveAssignment { |
| 364 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitMoveAssignment definition |
| 365 | // CHECK-NOT: MoveAssignment {{.*}}needs_implicit{{.*}} |
| 366 | DoesNotNeedImplicitMoveAssignment& operator=(DoesNotNeedImplicitMoveAssignment&&) {} |
| 367 | }; |
| 368 | |
| 369 | struct MoveAssignmentNeedsOverloadResolution : virtual DeletedDestructor { |
| 370 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveAssignmentNeedsOverloadResolution definition |
| 371 | // CHECK: MoveAssignment {{.*}}needs_overload_resolution{{.*}} |
| 372 | }; |
| 373 | |
| 374 | struct MoveAssignmentDoesNotNeedOverloadResolution { |
| 375 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveAssignmentDoesNotNeedOverloadResolution definition |
| 376 | // CHECK-NOT: MoveAssignment {{.*}}needs_overload_resolution{{.*}} |
| 377 | }; |
| 378 | |
| 379 | struct SimpleDestructor { |
| 380 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct SimpleDestructor definition |
| 381 | // CHECK: Destructor {{.*}}simple{{.*}} |
| 382 | }; |
| 383 | |
| 384 | struct NotSimpleDestructor : DeletedDestructor { |
| 385 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NotSimpleDestructor definition |
| 386 | // CHECK-NOT: Destructor {{.*}}simple{{.*}} |
| 387 | }; |
| 388 | |
| 389 | struct IrrelevantDestructor { |
| 390 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct IrrelevantDestructor definition |
| 391 | // CHECK: Destructor {{.*}}irrelevant{{.*}} |
| 392 | }; |
| 393 | |
| 394 | struct RelevantDestructor { |
| 395 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct RelevantDestructor definition |
| 396 | // CHECK-NOT: Destructor {{.*}}irrelevant{{.*}} |
| 397 | ~RelevantDestructor() {} |
| 398 | }; |
| 399 | |
| 400 | struct TrivialDestructor { |
| 401 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialDestructor definition |
| 402 | // CHECK: Destructor {{.*}} trivial{{.*}} |
| 403 | ~TrivialDestructor() = default; |
| 404 | }; |
| 405 | |
| 406 | struct NontrivialDestructor { |
| 407 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialDestructor definition |
| 408 | // CHECK: Destructor {{.*}}non_trivial{{.*}} |
| 409 | ~NontrivialDestructor() {} |
| 410 | }; |
| 411 | |
| 412 | struct UserDeclaredDestructor { |
| 413 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredDestructor definition |
| 414 | // CHECK: Destructor {{.*}}user_declared{{.*}} |
| 415 | ~UserDeclaredDestructor() {} |
| 416 | }; |
| 417 | |
| 418 | struct NonUserDeclaredDestructor { |
| 419 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredDestructor definition |
| 420 | // CHECK-NOT: Destructor {{.*}}user_declared{{.*}} |
| 421 | }; |
| 422 | |
| 423 | struct NeedsImplicitDestructor { |
| 424 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitDestructor definition |
| 425 | // CHECK: Destructor {{.*}}needs_implicit{{.*}} |
| 426 | int i = 12; |
| 427 | }; |
| 428 | |
| 429 | struct DoesNotNeedImplicitDestructor { |
| 430 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitDestructor definition |
| 431 | // CHECK-NOT: Destructor {{.*}}needs_implicit{{.*}} |
| 432 | ~DoesNotNeedImplicitDestructor() {} |
| 433 | }; |
| 434 | |
| 435 | struct DestructorNeedsOverloadResolution : virtual DeletedDestructor { |
| 436 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DestructorNeedsOverloadResolution definition |
| 437 | // CHECK: Destructor {{.*}}needs_overload_resolution{{.*}} |
| 438 | ~DestructorNeedsOverloadResolution(); |
| 439 | }; |
| 440 | |
| 441 | struct DestructorDoesNotNeedOverloadResolution { |
| 442 | // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct DestructorDoesNotNeedOverloadResolution definition |
| 443 | // CHECK-NOT: Destructor {{.*}}needs_overload_resolution{{.*}} |
| 444 | }; |
| 445 | |
| 446 | // FIXME: defaulted_is_deleted |
| 447 | |