Skip to content

Commit bd237c7

Browse files
committed
Make sure we aren't requiring local let/var to be labeled @unsafe
1 parent b3f2f00 commit bd237c7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/Unsafe/safe.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ extension UnsafeBufferPointer {
168168

169169
func testMyArray(ints: MyArray<Int>) {
170170
ints.withUnsafeBufferPointer { buffer in
171+
let bufferCopy = unsafe buffer
172+
_ = unsafe bufferCopy
173+
171174
// expected-warning@+1{{expression uses unsafe constructs but is not marked with 'unsafe'}}
172175
print(buffer.safeCount) // expected-note{{reference to parameter 'buffer' involves unsafe type 'UnsafeBufferPointer<Int>'}}
173176
unsafe print(buffer.baseAddress!)

0 commit comments

Comments
 (0)