Swift compiler segfault if default parameter value in generic function is a function from the generic type

Originator:bartek.chlebek
Number:rdar://19167509 Date Originated:06.12.2014
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 6.1.1
Classification:Crash Reproducible:Always
 
import Foundation

protocol Bar {
  class func bar()
}

struct MyStruct: Bar {
  static func bar() {
    println("bar")
  }
}

func foo<T: Bar>(a: () -> () = T.bar) -> T? {
  return nil
}

let x: MyStruct? = foo()

-------------------------------

Well, this crashes the compiler. Not much to say.

Version:
Xcode 6.1.1 (6A2008a) / OS X 10.10 (14A389)

Comments


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!