[SR-9548] EXC_BAD_ACCESS when casting NSError to custom Swift.Error within a function #51997
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
standard library
Area: Standard library umbrella
Environment
OS X: 10.14.2 (18C54)
Xcode: Version 10.1 (10B61)
swiftc --version
Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
Target: x86_64-apple-darwin18.2.0
Additional Detail from JIRA
md5: ec9ccf1e97e808e3f56a47fea6e90a24
duplicates:
Issue Description:
There is a crash with reason EXC_BAD_ACCESS when running the following code:
It does print "nil" from the "testFunction" in the Xcode console, but it gets crashed upon returning to the line
I used Xcode Playground to test the code.
As a workaround for the crash, you can first cast NSError to Swift.Error and then to a custom Swift.Error:
The text was updated successfully, but these errors were encountered: