Skip to content

Commit b8dc0f4

Browse files
committed
[stdlib] AutoreleasingMutableUnsafePointer: switch to _unsafeReferenceCast for extra validation
1 parent 88630e8 commit b8dc0f4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/public/core/BridgeObjectiveC.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,14 @@ public struct AutoreleasingUnsafeMutablePointer<Pointee /* TODO : class */>
394394
// explicitly handle the nil case.
395395
let unmanaged =
396396
UnsafePointer<Optional<Unmanaged<AnyObject>>>(_rawValue).pointee
397-
return unsafeBitCast(
397+
return _unsafeReferenceCast(
398398
unmanaged?.takeUnretainedValue(),
399399
to: Pointee.self)
400400
}
401401

402402
@_transparent nonmutating set {
403403
// Autorelease the object reference.
404-
let object = unsafeBitCast(newValue, to: Optional<AnyObject>.self)
404+
let object = _unsafeReferenceCast(newValue, to: Optional<AnyObject>.self)
405405
Builtin.retain(object)
406406
Builtin.autorelease(object)
407407

0 commit comments

Comments
 (0)