Skip to content

Commit 4368722

Browse files
committed
Test for swift_deallocUninitializedObject
1 parent 73e7df9 commit 4368722

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/embedded/closures-heap.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
// REQUIRES: optimized_stdlib
99
// REQUIRES: swift_feature_Embedded
1010

11+
12+
13+
func f() -> Bool? { return nil }
14+
1115
public class MyClass {
1216
var handler: (()->())? = nil
1317
func foo() {
@@ -32,5 +36,12 @@ struct Main {
3236
o!.foo() // CHECK: capture local
3337
print(local == 43 ? "43" : "???") // CHECK: 43
3438
o = nil // CHECK: deinit
39+
40+
let closure = {
41+
guard var b = f() else { print("success"); return }
42+
let c = { b = true }
43+
_ = (b, c)
44+
}
45+
closure() // CHECK: success
3546
}
3647
}

0 commit comments

Comments
 (0)