Xcode swift failed with exit code 254

前端 未结 7 2288
灰色年华
灰色年华 2021-02-07 14:14

I am getting this compiler error in my code and I can\'t figure out why:

:0: error: unable to execute command: Segmentation fault: 11


        
7条回答
  •  佛祖请我去吃肉
    2021-02-07 14:34

    This is a Swift compiler bug, apparently testing for two or more implicitly unwrapped optionals causes the compiler to crash under some/many circumstances. Use Apple's Bugreporter to file this issue, mark it as duplicate of rdar://17212295.

    Example

    Here's a minimal example that crashes with the same error:

    let a: String!
    let b: String!
    
    if a && b {
        println("have both")
    }
    

    Compile on command line as follows and witness the same crash:

    $ xcrun swift -v -g crash.swift
    

提交回复
热议问题