Swift: Compiler crash when defining a generic function with type constraint in a class extension

Originator:dieter.komendera
Number:rdar://18529754 Date Originated:02-Oct-2014
Status:Open Resolved:
Product:Developer Tools Product Version:Version 6.1 (6A1042b)
Classification: Reproducible:
 
Summary:
This crashes the compiler:

class ViewController: UIViewController {
}
extension ViewController {
  func showMeMaybe<T: UITableViewDelegate>() {
  }
}

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000010

VM Regions Near 0x10:
--> 
    __TEXT                 0000000103191000-0000000104d05000 [ 27.5M] r-x/rwx SM=COW  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   swift                         	0x00000001031e9ecc emitDirectTypeMetadataRef(swift::irgen::IRGenFunction&, swift::CanType) + 892
1   swift                         	0x00000001031e9a58 swift::irgen::IRGenFunction::emitTypeMetadataRef(swift::CanType) + 280
2   swift                         	0x000000010321da13 swift::irgen::emitPolymorphicArguments(swift::irgen::IRGenFunction&, swift::CanTypeWrapper<swift::SILFunctionType>, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::ArrayRef<swift::Substitution>, swift::irgen::Explosion&) + 451
3   swift                         	0x00000001032606b1 swift::SILVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::ValueBase*) + 34721
4   swift                         	0x00000001032572cb swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9179
5   swift                         	0x00000001031d0810 swift::irgen::IRGenModule::emitGlobalTopLevel() + 208
6   swift                         	0x0000000103243ffc performIRGeneration(swift::IRGenOptions&, swift::Module*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 1900

Steps to Reproduce:
1. Open the attached demo project
2. Build 

Expected Results:
Compiles successfully

Actual Results:
Compiler crash: Command failed due to signal: Segmentation fault: 11


Version:
Version 6.1 (6A1042b) Mac OS 10.10 (14A379a)

Notes:


Configuration:
n/a

Attachments:
'CrashDemo.zip' was successfully uploaded.

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!