Argyrios Kyrtzidis | e665d69 | 2011-06-18 00:53:41 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi %s |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 2 | |
| 3 | typedef int BOOL; |
| 4 | typedef const struct __CFString * CFStringRef; |
| 5 | |
| 6 | @class NSString; |
| 7 | |
| 8 | void f(BOOL b) { |
| 9 | CFStringRef cfstr; |
| 10 | 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}} \ |
| 11 | // expected-note{{use __bridge to convert directly (no change in ownership)}} \ |
| 12 | // expected-note{{use __bridge_transfer to transfer ownership of a +1 'CFStringRef' (aka 'const struct __CFString *') into ARC}} |
| 13 | void *vp = str; // expected-error {{disallowed}} |
| 14 | } |