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