Avatar
@swift-5.1.5 -O class Foo { private let deinitBody: () -> Void init(_ deinitBody: @escaping () -> Void) { self.deinitBody = deinitBody } deinit { deinitBody() } } func main() { var a = 42 var foo = Foo {} foo = Foo { a = -1 } let _ = foo // to ignore warnings print(a) } main()