@@ -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
} ;
@@ -64,13 +73,14 @@ private:
64
73
const int * member;
65
74
} ;
66
75
67
- // CHECK: sil [clang makeOwner] {{.*}}: $@convention(c) () -> Owner
76
+ // CHECK: sil [clang makeOwner] {{.*}} : $@convention(c) () -> Owner
68
77
// CHECK: sil [clang getView] {{.*}} : $@convention(c) (@in_guaranteed Owner) -> _scope(0) @autoreleased View
69
78
// CHECK: sil [clang getViewFromFirst] {{.*}} : $@convention(c) (@in_guaranteed Owner, @in_guaranteed Owner) -> _scope(0) @autoreleased View
70
79
// CHECK: sil [clang getViewFromEither] {{.*}} : $@convention(c) (@in_guaranteed Owner, @in_guaranteed Owner) -> _scope(0, 1) @autoreleased View
71
80
// CHECK: sil [clang Owner.handOutView] {{.*}} : $@convention(cxx_method) (@in_guaranteed Owner) -> _scope(0) @autoreleased View
72
81
// CHECK: sil [clang getViewFromEither] {{.*}} : $@convention(c) (@guaranteed View, @guaranteed View) -> _inherit(0, 1) @autoreleased View
73
82
// CHECK: sil [clang View.init] {{.*}} : $@convention(c) () -> @out View
83
+ // CHECK: sil [clang OtherView.init] {{.*}} : $@convention(c) (@guaranteed View) -> _inherit(0) @out OtherView
74
84
75
85
//--- test.swift
76
86
@@ -85,4 +95,5 @@ public func test() {
85
95
let _ = o. handOutView ( )
86
96
let _ = getViewFromEither ( v1, v2)
87
97
let defaultView = View ( )
98
+ let _ = OtherView ( defaultView)
88
99
}
0 commit comments