Swiftc crashes with seg fault 11 on compiling implementation of self constrained generic protocols.
| Originator: | Nikita.Leonov | ||
| Number: | rdar://23345347 | Date Originated: | October 31, 2015 |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 7.1 |
| Classification: | Crash/Hang/Data Loss | Reproducible: | Always |
Summary:
Following code is a miserable try to implement self-constrained generics for protocols, it crashes swiftc:
struct Container<T> {
}
protocol ContainerProtocol {
typealias ValueType
}
extension Container: ContainerProtocol {
typealias ValueType = T
}
class App<T: ContainerProtocol where T.ValueType == T> {
var container: T
init(_ container: T) {
self.container = container
}
}
App(Container())
Steps to Reproduce:
swiftc ./self-constrained-generic-protocol.swift
Expected Results:
it will compile
Actual Results:
it will crash with set fault 11
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!