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}}
8id (^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)();
11id (^invalidBlockRedecl)();
12#endif
13
14typedef __attribute__((ns_returns_retained)) id (^blockType)();
15
16typedef __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