Swift: Segmentation fault when compiling a specific combination of generic structs and protocols
| Originator: | adrian.kashivskyy | ||
| Number: | rdar://18176436 | Date Originated: | 29-Aug-2014 06:15 PM |
| Status: | Closed | Resolved: | Yes |
| Product: | Developer Tools | Product Version: | Xcode 6.0 Beta 6 (6A280e) |
| Classification: | Other Bug | Reproducible: | Always |
Summary:
Swift compiler segfaults when compiling the code described in the "Steps to reproduce" section.
Steps to Reproduce:
1. Install and open Xcode 6.0 Beta 6 (6A280e)
2. Create a new Swift project from OS X Command Line template (just for example)
3. Replace the contents of main.swift with the following code:
protocol FirstProtocol {
typealias FirstType
}
struct FirstStruct <T: FirstProtocol> {
let foo: T
let bar: T.FirstType
}
protocol SecondProtocol {
typealias SecondType
func baz <T where T.FirstType == SecondType> (f: FirstStruct<T>)
}
struct SecondStruct: SecondProtocol {
typealias SecondType = Int
func baz <T where T.FirstType == SecondType> (f: FirstStruct<T>) {}
}
4. Build the code
Expected Results:
Build succeeds with no compile errors.
Actual Results:
Swift compiler crashes with segmentation fault error.
Version:
Xcode 6.0 Beta 6 (6A280e)
OS X 10.9.4 (13E28)
MacPro5,1
Notes:
Issue can be fixed by either removing "bar" property declaration from the "FirstStruct" or removing the "SecondProtocol" comformance from "SecondStruct".
Configuration:
Issue is always reproducible, regardless of the SDK or other build configuration.
Attachments:
'segfault.log' was successfully uploaded.
--- 29-Aug-2014 06:22 PM
Constraining T to be a FirstProtocol in SecondProtocol does not fix the issue.
Related Apple Developer Forums thread: https://devforums.apple.com/message/1031654
--- 11-Feb-2015 02:34 PM
This issue has been verified as resolved and can be closed.
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!
Attachments
http://cl.ly/1Y1a3s3Q3v2L/download/rdar-18176436.zip