swift --version 11:40:11
Apple Swift version 4.2-dev (LLVM b7ee930770, Clang 5bae8c2e73, Swift 4160301759)
Function signature for test:
public func pcre2_compile_16(
_: PCRE2_SPTR16!,
_: Int,
_: UInt32,
_: UnsafeMutablePointer<Int32>!,
_: UnsafeMutablePointer<Int>!,
_: OpaquePointer!
) -> OpaquePointer!
Valid call:
let re = context.pattern.withCString(encodedAs: UTF16.self) {
return pcre2_compile_16(
$0,
context.pattern.utf16.count,
0,
&errorCode,
&errorOffset,
nil
)
}
Call with invalid argument:
let re = context.pattern.withCString(encodedAs: UTF16.self) {
return pcre2_compile_16(
$0,
context.pattern.utf16.count,
"hello", /// <--- must be UInt32, not String
&errorCode,
&errorOffset,
nil
)
}
Actual results:
cannot convert value of type 'UnsafePointer<_>' to expected argument type 'PCRE2_SPTR16?' (aka 'Optional<UnsafePointer>')