Hello.
I made a sample code to reproduce problems.
import Foundation
class ParentLevel {
init(someInfo: inout SomeDesc) throws {
}
deinit {
print("super deinit...")
}
}
struct SomeDesc {
let asdf: String
}
class DecendentLevel: ParentLevel {
private var descSome = SomeDesc(asdf: "1234")
init(args: String) throws {
try super.init(someInfo: &descSome)
}
deinit {
print("self deinit...")
}
}
somewhere in code
let temp = try! DecendentLevel(args: "123")
print(temp)
This code works well until Xcode 16.2, but when I compiled and works with Xcode 16.3, it shows EXC_BAD_ACCESS - object released immediately.
I assumed inout, so I fixed init argument of super class to work properly.
class DecendentLevel: ParentLevel {
private var descSome = SomeDesc(asdf: "1234")
init(args: String) throws {
var tempSome = SomeDesc(asdf: "1234")
try super.init(someInfo: &tempSome)
descSome = tempSome
}
deinit {
print("self deinit...")
}
}
But my question is, am I missing something like Swift changes between Swift 6.0 and 6.1?
I tried to find reasons (like release notes, forums, docs) but couldn't get the answer.
Thanks in advance.
- Test Platform : iOS Simulator iPhone16 Pro (18.4)
- Xcode 16.3 (16E140)