Skip to content

Commit ae0243c

Browse files
authored
Merge pull request #84987 from j-hui/value-semantics-implicit-dtors
2 parents 13e1787 + 0715522 commit ae0243c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8303,6 +8303,9 @@ static bool hasMoveTypeOperations(const clang::CXXRecordDecl *decl) {
83038303
}
83048304

83058305
static bool hasDestroyTypeOperations(const clang::CXXRecordDecl *decl) {
8306+
if (decl->hasSimpleDestructor())
8307+
return true;
8308+
83068309
if (auto dtor = decl->getDestructor()) {
83078310
if (dtor->isDeleted() || dtor->isIneligibleOrNotSelected() ||
83088311
dtor->getAccess() != clang::AS_public) {

test/Interop/Cxx/class/noncopyable-typechecker.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ struct SWIFT_NONCOPYABLE NonCopyableNonMovable { // expected-note {{record 'NonC
7979
NonCopyableNonMovable(NonCopyableNonMovable&& other) = delete;
8080
};
8181

82+
template<typename T> struct SWIFT_COPYABLE_IF(T) DisposableContainer {};
83+
struct POD { int x; float y; }; // special members are implicit, but should be copyable
84+
using DisposablePOD = DisposableContainer<POD>; // should also be copyable
8285

8386
//--- test.swift
8487
import Test
@@ -129,3 +132,7 @@ func missingLifetimeOperation() {
129132
let s = NonCopyableNonMovable() // expected-error {{cannot find 'NonCopyableNonMovable' in scope}}
130133
takeCopyable(s)
131134
}
135+
136+
func copyableDisposablePOD(p: DisposablePOD) {
137+
takeCopyable(p)
138+
}

0 commit comments

Comments
 (0)