| Fariborz Jahanian | 2fa646d | 2011-10-28 20:06:07 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s | 
|  | 2 | // RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s | 
|  | 3 | // rdar://10244607 | 
|  | 4 |  | 
|  | 5 | typedef const struct __CFString * CFStringRef; | 
|  | 6 | @class NSString; | 
|  | 7 |  | 
|  | 8 | NSString *CFBridgingRelease(); | 
|  | 9 |  | 
|  | 10 | typedef NSString * PNSString; | 
|  | 11 |  | 
|  | 12 | typedef __autoreleasing NSString * AUTORELEASEPNSString; | 
|  | 13 |  | 
|  | 14 | @interface I @end | 
|  | 15 |  | 
|  | 16 | @implementation I | 
|  | 17 | - (CFStringRef)myString | 
|  | 18 | { | 
|  | 19 | CFStringRef myString = | 
| Fariborz Jahanian | d01ddd1 | 2011-10-31 17:27:06 +0000 | [diff] [blame] | 20 | (__bridge CFStringRef) (__strong NSString *)CFBridgingRelease(); // expected-error {{explicit ownership qualifier on cast result has no effect}} | 
| Fariborz Jahanian | 2fa646d | 2011-10-28 20:06:07 +0000 | [diff] [blame] | 21 |  | 
|  | 22 | myString = | 
| Fariborz Jahanian | d01ddd1 | 2011-10-31 17:27:06 +0000 | [diff] [blame] | 23 | (__bridge CFStringRef) (__autoreleasing PNSString) CFBridgingRelease(); // expected-error {{explicit ownership qualifier on cast result has no effect}} | 
| Fariborz Jahanian | 2fa646d | 2011-10-28 20:06:07 +0000 | [diff] [blame] | 24 | myString = | 
|  | 25 | (__bridge CFStringRef) (AUTORELEASEPNSString) CFBridgingRelease(); // OK | 
| Fariborz Jahanian | 244b187 | 2011-10-29 00:06:10 +0000 | [diff] [blame] | 26 | myString = | 
| Fariborz Jahanian | d01ddd1 | 2011-10-31 17:27:06 +0000 | [diff] [blame] | 27 | (__bridge CFStringRef) (typeof(__strong NSString *)) CFBridgingRelease(); // expected-error {{explicit ownership qualifier on cast result has no effect}} | 
| Fariborz Jahanian | 2fa646d | 2011-10-28 20:06:07 +0000 | [diff] [blame] | 28 | return myString; | 
|  | 29 | } | 
|  | 30 |  | 
|  | 31 | - (void)decodeValueOfObjCType:(const char *)type at:(void *)addr { | 
|  | 32 | __autoreleasing id *stuff = (__autoreleasing id *)addr; | 
|  | 33 | } | 
|  | 34 | @end | 
| John McCall | 5ece54c | 2012-02-08 00:46:41 +0000 | [diff] [blame^] | 35 |  | 
|  | 36 | // rdar://problem/10711456 | 
|  | 37 | __strong I *__strong test1; // expected-error {{the type 'I *__strong' is already explicitly ownership-qualified}} | 
|  | 38 | __strong I *(__strong test2); // expected-error {{the type 'I *__strong' is already explicitly ownership-qualified}} | 
|  | 39 | __strong I *(__strong (test3)); // expected-error {{the type 'I *__strong' is already explicitly ownership-qualified}} | 
|  | 40 | __unsafe_unretained __typeof__(test3) test4; | 
|  | 41 | typedef __strong I *strong_I; | 
|  | 42 | __unsafe_unretained strong_I test5; |