@@ -16,6 +16,15 @@ struct SWIFT_NONESCAPABLE View {
16
16
View ( ) : member( nullptr) { }
17
17
View ( const int * p [ [ clang: : lifetimebound] ] ) : member( p) { }
18
18
View ( const View& ) = default;
19
+ private:
20
+ const int * member;
21
+ friend struct OtherView;
22
+ } ;
23
+
24
+ struct SWIFT_NONESCAPABLE OtherView {
25
+ OtherView ( ) : member( nullptr) { }
26
+ OtherView ( View v [ [ clang: : lifetimebound] ] ) : member( v. member) { }
27
+ OtherView ( const OtherView& ) = default;
19
28
private:
20
29
const int * member;
21
30
} ;
@@ -68,14 +77,15 @@ private:
68
77
const int * member;
69
78
} ;
70
79
71
- // CHECK: sil [clang makeOwner] {{.*}}: $@convention(c) () -> Owner
80
+ // CHECK: sil [clang makeOwner] {{.*}} : $@convention(c) () -> Owner
72
81
// CHECK: sil [clang getView] {{.*}} : $@convention(c) (@in_guaranteed Owner) -> _scope(0) @autoreleased View
73
82
// CHECK: sil [clang getViewFromFirst] {{.*}} : $@convention(c) (@in_guaranteed Owner, @in_guaranteed Owner) -> _scope(0) @autoreleased View
74
83
// CHECK: sil [clang getViewFromEither] {{.*}} : $@convention(c) (@in_guaranteed Owner, @in_guaranteed Owner) -> _scope(0, 1) @autoreleased View
75
84
// CHECK: sil [clang Owner.handOutView] {{.*}} : $@convention(cxx_method) (@in_guaranteed Owner) -> _scope(0) @autoreleased View
76
85
// CHECK: sil [clang Owner.handOutView2] {{.*}} : $@convention(cxx_method) (View, @in_guaranteed Owner) -> _scope(1) @autoreleased View
77
86
// CHECK: sil [clang getViewFromEither] {{.*}} : $@convention(c) (@guaranteed View, @guaranteed View) -> _inherit(0, 1) @autoreleased View
78
87
// CHECK: sil [clang View.init] {{.*}} : $@convention(c) () -> @out View
88
+ // CHECK: sil [clang OtherView.init] {{.*}} : $@convention(c) (@guaranteed View) -> _inherit(0) @out OtherView
79
89
80
90
//--- test.swift
81
91
@@ -91,4 +101,5 @@ public func test() {
91
101
let _ = o. handOutView2 ( v1)
92
102
let _ = getViewFromEither ( v1, v2)
93
103
let defaultView = View ( )
104
+ let _ = OtherView ( defaultView)
94
105
}
0 commit comments