Files
swift-mirror/validation-test/ClangImporter/memcmp-definitions.swift
Alexis Laferrière 0c27a4c38c SwiftShims: memcmp should accept optional pointers on Darwin
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
2024-12-04 14:58:32 -08:00

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)
}