Crash converging [String:Any?] to [String:AnyObject]

Originator:robnapier
Number:rdar://23348366 Date Originated:01-Nov-2015 03:14 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7.1 (7B91b)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
The following code crashes at runtime with "fatal error: can't unsafeBitCast between types of different sizes."

let dict:[String : Any?] = ["something" : "else"]
let newDict = dict as? [String: AnyObject]

This code should either return a compiler error or newDict should be nil. It should never generate a runtime crash.

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!