Avatar
@swiftbot struct HaveResult { var resultCode = 0 mutating func returnResultCode(_ value: Int) -> Int { return resultCode } } public func testA() { var r = HaveResult() print(r.returnResultCode(changeResult(r: &r))) } func testA_variant() { var r = HaveResult() var r2 = r print(r2.returnResultCode(changeResult(r: &r))) } func testB() { var r = HaveResult() var x = changeResult(r: &r) print(r.returnResultCode(x)) } func changeResult(r: inout HaveResult) -> Int { r.resultCode = 1 return 0 } testA() testA_variant() testB()
🛠 1