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 {
115
115
}
116
116
}
117
117
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
+
118
132
// CHECK: sil [clang makeOwner] {{.*}}: $@convention(c) () -> Owner
119
133
// CHECK: sil [clang getView] {{.*}} : $@convention(c) (@in_guaranteed Owner) -> @lifetime(borrow 0) @owned View
120
134
// CHECK: sil [clang getViewFromFirst] {{.*}} : $@convention(c) (@in_guaranteed Owner, @in_guaranteed Owner) -> @lifetime(borrow 0) @owned View
@@ -130,6 +144,7 @@ namespace NS {
130
144
// CHECK: sil [clang CaptureView.captureView] {{.*}} : $@convention(cxx_method) (View, @lifetime(copy 0) @inout CaptureView) -> ()
131
145
// CHECK: sil [clang CaptureView.handOut] {{.*}} : $@convention(cxx_method) (@lifetime(copy 1) @inout View, @in_guaranteed CaptureView) -> ()
132
146
// 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
133
148
134
149
//--- test.swift
135
150
@@ -157,3 +172,7 @@ public func test() {
157
172
public func test2( _ x: AggregateView ) {
158
173
let _ = AggregateView ( member: x. member)
159
174
}
175
+
176
+ func canImportMoveOnlyNonEscapable( _ x: borrowing MoveOnly ) {
177
+ let _ = moveOnlyId ( x) ;
178
+ }
You can’t perform that action at this time.
0 commit comments