App crashes on iOS12 Simulator

Number:rdar://FB9979517 Date Originated:11-04-2022
Status:Open Resolved:
Product:iOS12 Simulator Product Version:
Classification: Reproducible:Always
The following function crashes on iOS12 Simulator (but NOT on iOS13 Simulator):

func testCrash() {
        enum Wrapper {
            case failure(NSError)
        enum SomeError: Error {}
        enum CrashingError: CustomNSError {
            case failure
        let carshingError = CrashingError.failure
        let wrapped = Wrapper.failure(carshingError as NSError)
        switch wrapped {
        case .failure(let error):
            guard let castedError = error as? SomeError else {


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!