diff options
Diffstat (limited to 'test/ARCMT/nonobjc-to-objc-cast-2.m')
-rw-r--r-- | test/ARCMT/nonobjc-to-objc-cast-2.m | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ARCMT/nonobjc-to-objc-cast-2.m b/test/ARCMT/nonobjc-to-objc-cast-2.m new file mode 100644 index 0000000..46ef024 --- /dev/null +++ b/test/ARCMT/nonobjc-to-objc-cast-2.m @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi %s + +typedef int BOOL; +typedef const struct __CFString * CFStringRef; + +@class NSString; + +void f(BOOL b) { + CFStringRef cfstr; + 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 __bridge_transfer to transfer ownership of a +1 'CFStringRef' (aka 'const struct __CFString *') into ARC}} + void *vp = str; // expected-error {{disallowed}} +} |