@@ -16,6 +16,15 @@ struct SWIFT_NONESCAPABLE View {
1616 View ( ) : member( nullptr) { }
1717 View ( const int * p [ [ clang: : lifetimebound] ] ) : member( p) { }
1818 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;
1928private:
2029 const int * member;
2130} ;
@@ -64,13 +73,14 @@ private:
6473 const int * member;
6574} ;
6675
67- // CHECK: sil [clang makeOwner] {{.*}}: $@convention(c) () -> Owner
76+ // CHECK: sil [clang makeOwner] {{.*}} : $@convention(c) () -> Owner
6877// CHECK: sil [clang getView] {{.*}} : $@convention(c) (@in_guaranteed Owner) -> _scope(0) @autoreleased View
6978// CHECK: sil [clang getViewFromFirst] {{.*}} : $@convention(c) (@in_guaranteed Owner, @in_guaranteed Owner) -> _scope(0) @autoreleased View
7079// CHECK: sil [clang getViewFromEither] {{.*}} : $@convention(c) (@in_guaranteed Owner, @in_guaranteed Owner) -> _scope(0, 1) @autoreleased View
7180// CHECK: sil [clang Owner.handOutView] {{.*}} : $@convention(cxx_method) (@in_guaranteed Owner) -> _scope(0) @autoreleased View
7281// CHECK: sil [clang getViewFromEither] {{.*}} : $@convention(c) (@guaranteed View, @guaranteed View) -> _inherit(0, 1) @autoreleased View
7382// CHECK: sil [clang View.init] {{.*}} : $@convention(c) () -> @out View
83+ // CHECK: sil [clang OtherView.init] {{.*}} : $@convention(c) (@guaranteed View) -> _inherit(0) @out OtherView
7484
7585//--- test.swift
7686
@@ -85,4 +95,5 @@ public func test() {
8595 let _ = o. handOutView ( )
8696 let _ = getViewFromEither ( v1, v2)
8797 let defaultView = View ( )
98+ let _ = OtherView ( defaultView)
8899}
0 commit comments