mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Darwin defines memcmp with optional pointers. Update SwiftShims to define it to the same type to avoid deserialization failures where we get one over the other and the types don't match anymore. rdar://140596571
16 lines
409 B
Swift
16 lines
409 B
Swift
/// Darwin's memcmp accepts nullable pointers, make sure the SwiftShims one
|
|
/// preserves the same type.
|
|
// REQUIRES: VENDOR=apple
|
|
// RUN: %target-build-swift %s -o %t.out
|
|
|
|
import SwiftShims
|
|
import Foundation
|
|
|
|
func foo () {
|
|
let a = UnsafeMutableRawPointer.allocate(byteCount: 4, alignment: 4)
|
|
let b = UnsafeMutableRawPointer.allocate(byteCount: 4, alignment: 4)
|
|
memcmp(a, b, 4)
|
|
|
|
memcmp(nil, nil, 0)
|
|
}
|