@@ -316,3 +316,36 @@ func testLocalCaptures() {
316
316
// expected-complete-and-sns-warning@-1 {{capture of 'ns' with non-sendable type 'NonSendable' in a `@Sendable` local function}}
317
317
}
318
318
}
319
+
320
+ func testPointersAreNotSendable( ) {
321
+ func testSendable< T: Sendable > ( _: T ) { }
322
+
323
+ func testUnsafePointer( ptr: UnsafePointer < Int > ,
324
+ mutablePtr: UnsafeMutablePointer < String > ) {
325
+ testSendable ( ptr) // expected-warning {{conformance of 'UnsafePointer<Pointee>' to 'Sendable' is unavailable}}
326
+ testSendable ( mutablePtr) // expected-warning {{conformance of 'UnsafeMutablePointer<Pointee>' to 'Sendable' is unavailable}}
327
+ }
328
+
329
+ func testRawPointer( ptr: UnsafeRawPointer ,
330
+ mutablePtr: UnsafeMutableRawPointer ) {
331
+ testSendable ( ptr) // expected-warning {{conformance of 'UnsafeRawPointer' to 'Sendable' is unavailable}}
332
+ testSendable ( mutablePtr) // expected-warning {{conformance of 'UnsafeMutableRawPointer' to 'Sendable' is unavailable}}
333
+ }
334
+
335
+ func testOpaqueAndCPointers( opaquePtr: OpaquePointer , cPtr: CVaListPointer , autoReleasePtr: AutoreleasingUnsafeMutablePointer < Int > ) {
336
+ testSendable ( opaquePtr) // expected-warning {{conformance of 'OpaquePointer' to 'Sendable' is unavailable}}
337
+ testSendable ( cPtr) // expected-warning {{conformance of 'CVaListPointer' to 'Sendable' is unavailable}}
338
+ testSendable ( autoReleasePtr) // expected-warning {{conformance of 'AutoreleasingUnsafeMutablePointer<Pointee>' to 'Sendable' is unavailable}}
339
+ }
340
+
341
+ func testBufferPointers( buffer: UnsafeBufferPointer < Int > , mutableBuffer: UnsafeMutableBufferPointer < Int > ,
342
+ rawBuffer: UnsafeRawBufferPointer , rawMutableBuffer: UnsafeMutableRawBufferPointer ) {
343
+ testSendable ( buffer) // expected-warning {{conformance of 'UnsafeBufferPointer<Element>' to 'Sendable' is unavailable}}
344
+ testSendable ( mutableBuffer) // expected-warning {{conformance of 'UnsafeMutableBufferPointer<Element>' to 'Sendable' is unavailable}}
345
+ testSendable ( buffer. makeIterator ( ) ) // expected-warning {{conformance of 'UnsafeBufferPointer<Element>.Iterator' to 'Sendable' is unavailable}}
346
+ testSendable ( rawBuffer) // expected-warning {{conformance of 'UnsafeRawBufferPointer' to 'Sendable' is unavailable}}
347
+ testSendable ( rawBuffer. makeIterator ( ) ) // expected-warning {{conformance of 'UnsafeRawBufferPointer.Iterator' to 'Sendable' is unavailable}}
348
+ testSendable ( rawMutableBuffer) // expected-warning {{conformance of 'UnsafeMutableRawBufferPointer' to 'Sendable' is unavailable}}
349
+ testSendable ( rawMutableBuffer. makeIterator ( ) ) // expected-warning {{conformance of 'UnsafeRawBufferPointer.Iterator' to 'Sendable' is unavailable}}
350
+ }
351
+ }
0 commit comments