Skip to content

Commit 010415f

Browse files
committed
Sema: Force destructor synthesis in evaluateMembersRequest()
1 parent 99d68ba commit 010415f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2781,6 +2781,11 @@ static ArrayRef<Decl *> evaluateMembersRequest(
27812781
// We need to add implicit initializers because they
27822782
// affect vtable layout.
27832783
TypeChecker::addImplicitConstructors(nominal);
2784+
2785+
// Destructors don't affect vtable layout, but TBDGen needs to
2786+
// see them, so we also force the destructor here.
2787+
if (auto *classDecl = dyn_cast<ClassDecl>(nominal))
2788+
(void) classDecl->getDestructor();
27842789
}
27852790

27862791
// Force any conformances that may introduce more members.

test/ModuleInterface/resolve-imports.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,11 @@ public func f() -> Int {}
1212
// get type checked.
1313
private func bad1(_: NotAThing) -> DoesNotExist {}
1414

15-
internal typealias Bad1 = NotEvenReal.DefinitelyNot
15+
internal typealias Bad1 = NotEvenReal.DefinitelyNot
16+
17+
// Destructors
18+
public class C {}
19+
20+
// CHECK: public class C {
21+
// CHECK: deinit
22+
// CHECK: }

0 commit comments

Comments
 (0)