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