CFBridgingRetain and CFAutorelease produce warnings under -Wincompatible-pointer-types-discards-qualifiers
| Originator: | jtbandes | ||
| Number: | rdar://21374092 | Date Originated: | 6/13/2015 |
| Status: | Open | Resolved: | |
| Product: | Product Version: | ||
| Classification: | Reproducible: |
Summary: The new -Wincompatible-pointer-types-discards-qualifiers warning is produced when using CFBridgingRetain and assigning to a variable of any particular type: CGColorSpaceRef cspace = CFAutorelease(<some object>); or void *context = CFBridgingRetain(<some object>); produces "warning: initializing 'CGColorSpaceRef' (aka 'struct CGColorSpace *') with an expression of type 'CFTypeRef __nullable' (aka 'const void *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]" Steps to Reproduce: Try the following code with -Wincompatible-pointer-types-discards-qualifiers enabled (default in Xcode 7): CGColorSpaceRef cspace = CFAutorelease(<some object>); // or void *context = CFBridgingRetain(<some object>); Expected Results: The result of CFBridgingRetain and CFAutorelease should be usable with other CF APIs with no warnings. Actual Results: Warnings are produced. Version: Xcode 7 beta 1
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!