Swift/LLVM: "Broken function found, compilation aborted"

Originator:jtbandes
Number:rdar://23508601 Date Originated:11/11/2015
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7.1.1 & 7.2
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
The following code fails to compile with the error

    Call parameter type does not match function signature!
      %4 = bitcast i8* %.fn.load to { %objc_block, %swift.function }*
     void (...)*  tail call void @_TTRXFo__dT__XFdCb__dT__({ %objc_block, %swift.function }* %4) #0
    LLVM ERROR: Broken function found, compilation aborted!

Steps to Reproduce:
Take the following code (crash.swift) and run it with

    $ xcrun -sdk macosx swiftc crash.swift



import AppKit

func func1(@noescape block: () -> Void) { }
func func2(@noescape block: @convention(block) () -> Void) { }

func func3()
{
    NSAnimationContext.runAnimationGroup({_ in }, completionHandler: nil)
    
    func1 {
        var iable = false
        func2 {
            iable = true
        }
    }
}


Expected Results:
The code compiles

Actual Results:
swiftc/LLVM crashes

Version:
Xcode 7.1.1 (7B1005), and 7.2 beta (7C46t)

Notes:


Configuration:
OS X 10.11.1 (15B42)

Comments

This issue is fixed in the latest Xcode 7.2 beta (7C62)


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com 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!