diff options
Diffstat (limited to 'clang/test/SemaObjC/arc-cf.m')
-rw-r--r-- | clang/test/SemaObjC/arc-cf.m | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/arc-cf.m b/clang/test/SemaObjC/arc-cf.m new file mode 100644 index 00000000000..9a1750a445d --- /dev/null +++ b/clang/test/SemaObjC/arc-cf.m @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify %s + +typedef const void *CFTypeRef; +typedef const struct __CFString *CFStringRef; + +extern CFStringRef CFMakeString0(void); +extern CFStringRef CFCreateString0(void); +void test0() { + id x; + x = (id) CFMakeString0(); // expected-error {{requires a bridged cast}} expected-note {{__bridge to convert directly}} expected-note {{__bridge_transfer to transfer}} + x = (id) CFCreateString0(); // expected-error {{requires a bridged cast}} expected-note {{__bridge to convert directly}} expected-note {{__bridge_transfer to transfer}} +} + +extern CFStringRef CFMakeString1(void) __attribute__((cf_returns_not_retained)); +extern CFStringRef CFCreateString1(void) __attribute__((cf_returns_retained)); +void test1() { + id x; + x = (id) CFMakeString1(); + x = (id) CFCreateString1(); // expected-error {{requires a bridged cast}} expected-note {{__bridge to convert directly}} expected-note {{__bridge_transfer to transfer}} +} |