Avatar
swiftbot BOT 1/11/2019 2:41 AM
Author icon
t.ae
struct HaveResult { var resultCode = 0 func returnResultCode(_ value: Int) -> Int { return resultCode } } func testA() { var r = HaveResult() print(r.returnResultCode(changeResult(r: &r))) } func testA_variant() { var r = HaveResult() let r2 = r print(r2.returnResultCode(changeResult(r: &r))) } func testB() { var r = HaveResult() let x = changeResult(r: &r) print(r.returnResultCode(x)) } func changeResult(r: inout HaveResult) -> Int { r.resultCode = 1 return 0 } testA() testA_variant() testB()
Version:
swift-4.2.1-RELEASE
Output:
0 0 1
Error: