[SR-2863] Calling closures with inout parameter inside a generic function causes runtime error #45457
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
regression
runtime
The Swift Runtime
swift 3.0
Attachment: Download
Additional Detail from JIRA
md5: 0704b664287f1c92d42927ae3bb5eb89
duplicates:
Issue Description:
I was using the `with` function [introduced by Erica Sadun and Brent Royal-Gordon](https://gist.github.com/brentdax/ce3272e3d35f5ccac56483666f86b8fb). It works perfectly fine in Swift 2.2, but stops working in Swift 3.0 now.
Here is a minimum version of `with` function that still can reproduce the error:
It throws the following error if I use it to initialize an object:
Screenshot of showing this error in Playground (swift-DEVELOPMENT-SNAPSHOT-2016-10-02-a):
However a similar function works if the generic parameter is removed, like this one:
The original function also works if a constant or variable is passed in instead:
Is this a bug? Is the original `with` function supposed to work in Swift 3.0?
The text was updated successfully, but these errors were encountered: