I have a function that returns an NSError object by reference:
NSData *foo(NSData *foo, NSError *__autoreleasing *outError);
This function uses an API that takes a pointer to storage for a CFErrorRef. I'd like to just pass outError
to the underlying function directly, but I can't figure out the correct combination of declaration keywords and cast keywords to make clang agree with that plan. Is there one?
If you look at the clang notes for __autoreleasing
it mentions that the magic happens at assignment time, which means that automatic casting can't help here. You need to actually make the assignment using a temporary variable as mentioned in the comments on the original post.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With