diff options
Diffstat (limited to 'test/ARCMT/checking.m')
-rw-r--r-- | test/ARCMT/checking.m | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/ARCMT/checking.m b/test/ARCMT/checking.m index b06f4a7..a550633 100644 --- a/test/ARCMT/checking.m +++ b/test/ARCMT/checking.m @@ -333,7 +333,9 @@ void rdar9504750(id p) { } @end -@interface Test10 : NSObject +@interface Test10 : NSObject { + CFStringRef cfstr; +} @property (retain) id prop; -(void)foo; @end @@ -342,3 +344,13 @@ void test(Test10 *x) { x.prop = ^{ [x foo]; }; // expected-warning {{likely to lead to a retain cycle}} \ // expected-note {{retained by the captured object}} } + +@implementation Test10 +-(void)foo { + ^{ + NSString *str = (NSString *)cfstr; // expected-error {{cast of C pointer type 'CFStringRef' (aka 'const struct __CFString *') to Objective-C pointer type 'NSString *' requires a bridged cast}} \ + // expected-note {{use __bridge to convert directly (no change in ownership)}} \ + // expected-note {{use CFBridgingRelease call to transfer ownership of a +1 'CFStringRef' (aka 'const struct __CFString *') into ARC}} + }; +} +@end |