We faced an issue which has to do with AutoreleasingUnsafeMutablePointer<Pointee> not keeping the value of a set objet.
We use the cited struct, pointee property, to store some values. Depending on the logic, sometimes the value to store is a NSNull, because it is the output of a casting.
After updating to Xcode 11.4 we've notices that depending on the optimization process triggered when compiling, that value is stored or not. E.g.:
- -Onone => this mode makes NSNull value not kept, making the value of the pointee property nil.
- -O => this mode makes the pointee property to hold NSNull value.
We were wondering whether that implementation change in the behaviour of the struct AutoreleasingUnsafeMutablePointer is right and something on purpuse, depending on the optimization mode used when it comes to compile.
Definitely, prior to Xcode 11.4 the described behaviour didn't occur, where AutoreleasingUnsafeMutablePointer.pointee always held NSNull value, regardless of the optimization mode.