Skip to content

Commit f56fa41

Browse files
committed
[cxx-interop] Always instantiate the default destructor
This fixes a linker error when using `std::function` from Swift. rdar://103979602
1 parent 876c056 commit f56fa41

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/IRGen/GenClangDecl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ void IRGenModule::emitClangDecl(const clang::Decl *decl) {
263263
// Unfortunately, implicitly defined CXXDestructorDecls don't have a real
264264
// body, so we need to traverse these manually.
265265
if (auto *dtor = dyn_cast<clang::CXXDestructorDecl>(next)) {
266+
if (dtor->isImplicit() && dtor->isDefaulted() && !dtor->isDeleted() &&
267+
!dtor->doesThisDeclarationHaveABody())
268+
clangSema.DefineImplicitDestructor(dtor->getLocation(), dtor);
269+
266270
if (dtor->isImplicit() || dtor->hasBody()) {
267271
auto cxxRecord = dtor->getParent();
268272

0 commit comments

Comments
 (0)