| 1 |
// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fblocks -verify %s |
| 3 |
|
| 4 |
#if __has_feature(objc_arc) |
| 5 |
__attribute__((ns_returns_retained)) id (^invalidBlockRedecl)(void); // expected-note {{previous definition is here}} |
| 6 |
id (^invalidBlockRedecl)(void); //expected-error {{redefinition of 'invalidBlockRedecl' with a different type: 'id (^__strong)(void)' vs 'id ((^__strong))(void) __attribute__((ns_returns_retained))'}} |
| 7 |
#else |
| 8 |
__attribute__((ns_returns_retained)) id (^invalidBlockRedecl)(void); |
| 9 |
id (^invalidBlockRedecl)(void); |
| 10 |
#endif |
| 11 |
|
| 12 |
typedef __attribute__((ns_returns_retained)) id (^blockType)(void); |
| 13 |
|
| 14 |
typedef __attribute__((ns_returns_retained)) int (^invalidBlockType)(void); // expected-warning {{'ns_returns_retained' attribute only applies to functions that return an Objective-C object}} |
| 15 |
|
| 16 |
__attribute__((ns_returns_retained)) int functionDecl(void); // expected-warning {{'ns_returns_retained' attribute only applies to functions that return an Objective-C object}} |