File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-swift-frontend %s -enable-experimental-feature Embedded -O -c -o %t/main.o
3
+ // RUN: %target-clang %t/main.o -o %t/a.out -dead_strip
4
+ // RUN: %target-run %t/a.out | %FileCheck %s
5
+
6
+ // REQUIRES: swift_in_compiler
7
+ // REQUIRES: executable_test
8
+ // REQUIRES: OS=macosx || OS=linux-gnu
9
+
10
+ public var global_c : C ? = nil
11
+
12
+ @inline ( never) func opaque( ) { print ( global_c == nil ? " global is nil " : " global is not nil " ) }
13
+
14
+ public class C {
15
+ init ( ) { print ( " init " ) }
16
+ deinit {
17
+ print ( " deinit " )
18
+ global_c = self
19
+ opaque ( )
20
+ global_c = nil
21
+ opaque ( )
22
+ print ( " end of deinit " )
23
+ }
24
+ }
25
+
26
+ var bar : C ? = C ( )
27
+ bar = nil
28
+ print ( " OK! " )
29
+
30
+ // CHECK: init
31
+ // CHECK: deinit
32
+ // CHECK: global is not nil
33
+ // CHECK: global is nil
34
+ // CHECK: end of deinit
35
+ // CHECK: OK!
You can’t perform that action at this time.
0 commit comments