diff options
Diffstat (limited to 'test/SemaObjC/arc-cf.m')
-rw-r--r-- | test/SemaObjC/arc-cf.m | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/SemaObjC/arc-cf.m b/test/SemaObjC/arc-cf.m new file mode 100644 index 0000000000000..c1df3e0489f1d --- /dev/null +++ b/test/SemaObjC/arc-cf.m @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -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}} +} |