File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,20 @@ namespace NS {
115115 }
116116}
117117
118+ struct SWIFT_NONCOPYABLE SWIFT_NONESCAPABLE MoveOnly {
119+ MoveOnly ( ) ;
120+ MoveOnly ( const MoveOnly& other) = delete;
121+ MoveOnly& operator= ( const MoveOnly& ) = delete;
122+ MoveOnly ( MoveOnly&& other) = default;
123+ MoveOnly& operator= ( MoveOnly&& other) = default;
124+ ~ MoveOnly( ) ;
125+
126+ private:
127+ int * i;
128+ } ;
129+
130+ MoveOnly moveOnlyId( const MoveOnly& p [ [ clang: : lifetimebound] ] ) ;
131+
118132// CHECK: sil [clang makeOwner] {{.*}}: $@convention(c) () -> Owner
119133// CHECK: sil [clang getView] {{.*}} : $@convention(c) (@in_guaranteed Owner) -> @lifetime(borrow 0) @owned View
120134// CHECK: sil [clang getViewFromFirst] {{.*}} : $@convention(c) (@in_guaranteed Owner, @in_guaranteed Owner) -> @lifetime(borrow 0) @owned View
@@ -130,6 +144,7 @@ namespace NS {
130144// CHECK: sil [clang CaptureView.captureView] {{.*}} : $@convention(cxx_method) (View, @lifetime(copy 0) @inout CaptureView) -> ()
131145// CHECK: sil [clang CaptureView.handOut] {{.*}} : $@convention(cxx_method) (@lifetime(copy 1) @inout View, @in_guaranteed CaptureView) -> ()
132146// CHECK: sil [clang NS.getView] {{.*}} : $@convention(c) (@in_guaranteed Owner) -> @lifetime(borrow 0) @owned View
147+ // CHECK: sil [clang moveOnlyId] {{.*}} : $@convention(c) (@in_guaranteed MoveOnly) -> @lifetime(borrow {{.*}}0) @out MoveOnly
133148
134149//--- test.swift
135150
@@ -157,3 +172,7 @@ public func test() {
157172public func test2( _ x: AggregateView ) {
158173 let _ = AggregateView ( member: x. member)
159174}
175+
176+ func canImportMoveOnlyNonEscapable( _ x: borrowing MoveOnly ) {
177+ let _ = moveOnlyId ( x) ;
178+ }
You can’t perform that action at this time.
0 commit comments