[SR-6714] Runtime crash when passing an array of mutable pointers to a parameter expecting an array of immutable pointers #49263
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
crash
Bug: A crash, i.e., an abnormal termination of software
run-time crash
Bug → crash: Swift code crashed during execution
type checker
Area → compiler: Semantic analysis
Environment
Apple Swift version 4.1-dev (LLVM 5d946db43c, Clang 1212e53405, Swift d726bd8)
Target: x86_64-apple-darwin15.6.0
Additional Detail from JIRA
md5: 283790d2dde6ebe543f8b4f0a8b2eb46
Issue Description:
The following crashes at runtime:
with the message "Could not cast value of type 'Swift.UnsafeMutablePointer<Swift.Int>' (0x11338a288) to 'Swift.UnsafePointer<Swift.Int>'".
This is unexpected because there are no force casts in the above code. Either the compiler should reject the passing of an
[UnsafeMutablePointer]
to a[UnsafePointer]
parameter, or the runtime should perform the conversion.The text was updated successfully, but these errors were encountered: