Implement a method incorrectly by using generic rather than protocol parameter crashes clang compiler
| Originator: | saul | ||
| Number: | rdar://21751305 | Date Originated: | 2015-7-9 |
| Status: | Open | Resolved: | |
| Product: | Xcode | Product Version: | 6.4 |
| Classification: | Reproducible: |
Summary:
Mistakingly implementing a protocol using a generic implementation rather than the protocol parameter specified in the protocol causes a segfault 11 error. This scenario is common since generic protocol parameters aren't supported in some scenarios. The solution is to change from the generic version of the function/method and explicitly label the parameter type to the protocol itself
Steps to Reproduce:
Attempt to compile this snippet into Xcode:
protocol Thing {
var name: String { get }
}
protocol UsingThing {
func doSomething(with: Thing)
}
struct Test: UsingThing {
func doSomething<T: Thing>(thing: T) {
}
}
Expected Results:
Expected this compile to fail with an error message telling me the implementation of the function in the struct is specified incorrectly, and should point me to the protocol for reference
Actual Results:
Segfault 11
See attached Xcode Playground crashlog
Version:
Xcode 6.4 (6E35b)
OS X 10.10.4
Notes:
Workaround: Find all instances of improper use of method and correct usage.
Configuration:
Xcode Playground
Attachments:
'com.apple.dt.Xcode.Playground_2015-07-09-131337_honolulu.crash' 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!