Swift fails to compile class with generic constant property

Originator:jlieske
Number:rdar://17225270 Date Originated:08-Jun-2014 03:21 PM
Status:Closed Resolved:Fixed in iOS 8 SDK Beta 3
Product:OS X SDK Product Version:Xcode6 beta: Version 6.0 (6A215l)
Classification:Crash Reproducible:Always
 
The Swift language supports generic classes with type parameters, and those type parameters should be able to declare the type of "let" constant properties in instances of the class.  

For example, this seems to be a reasonable, minimal class:

class Holder<T> {
    let value: T
    init(_ value: T) {self.value = value}
}

However, it fails to compile in Swift source code files.  The compiler reports the error:

/Users/jay/Coding/Swift/TrySwift/TryHolder/main.swift:10:9: error: unimplemented IR generation feature non-fixed class layout
    let value: T
        ^
LLVM ERROR: unimplemented IRGen feature! non-fixed class layout
Command /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 1

Furthermore, pasting that class definition in a Playground file causes Xcode to crash.  When Xcode tries to re-launch with the Playground file with the definition, it crashes repeatedly.

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!