Swift: Compiler crashes on a function passing a AutoreleasingUnsafeMutablePointer of a stack variable of generic type into a function
Originator: | rix.rob | ||
Number: | rdar://19091061 | Date Originated: | 27-Nov-2014 03:56 PM |
Status: | Open | Resolved: | |
Product: | Developer Tools | Product Version: | Xcode 6.1.1 (6A2006) |
Classification: | Crash/Hang/Data Loss | Reproducible: | Always |
Summary: Segfault on `init` in the code sample below. Steps to Reproduce: 1. Code: struct S<T> { init(f: AutoreleasingUnsafeMutablePointer<T?> -> ()) { var t: T? f(&t) } } Expected Results: ๐ Actual Results: ๐ฅ Regression: Changing the init to this does not crash: init(f: (inout T?) -> ()) { var t: T? f(&t) } It crashes but without any stack dump if you donโt use a generic type: struct S { init(f: AutoreleasingUnsafeMutablePointer<Int?> -> ()) { var t: Int? f(&t) } } Notes: I kinda wanted to make a Result enum constructor doing something like this with NSError: https://github.com/LlamaKit/LlamaKit/pull/14
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!