diff options
Diffstat (limited to 'test/ARCMT/nonobjc-to-objc-cast-2.m')
-rw-r--r-- | test/ARCMT/nonobjc-to-objc-cast-2.m | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ARCMT/nonobjc-to-objc-cast-2.m b/test/ARCMT/nonobjc-to-objc-cast-2.m index 80d694e..e554c7d 100644 --- a/test/ARCMT/nonobjc-to-objc-cast-2.m +++ b/test/ARCMT/nonobjc-to-objc-cast-2.m @@ -54,3 +54,12 @@ CFStringRef f3() { return (CFStringRef)[[[NSString alloc] init] autorelease]; // expected-error {{it is not safe to cast to 'CFStringRef' the result of 'autorelease' message; a __bridge cast may result in a pointer to a destroyed object and a __bridge_retained may leak the object}} \ // expected-note {{remove the cast and change return type of function to 'NSString *' to have the object automatically autoreleased}} } + +extern void NSLog(NSString *format, ...); + +// rdar://13192395 +void f4(NSString *s) { + NSLog(@"%@", (CFStringRef)s); // expected-error {{cast of Objective-C pointer type 'NSString *' to C pointer type 'CFStringRef' (aka 'const struct __CFString *') requires a bridged cast}} \ + // expected-note{{use __bridge to convert directly (no change in ownership)}} \ + // expected-note{{use CFBridgingRetain call to make an ARC object available as a +1 'CFStringRef' (aka 'const struct __CFString *')}} +} |