Fariborz Jahanian | 52b2e1e | 2010-02-12 17:52:31 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp |
Fariborz Jahanian | 264e159 | 2010-02-16 22:13:48 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp |
Fariborz Jahanian | 52b2e1e | 2010-02-12 17:52:31 +0000 | [diff] [blame] | 3 | // radar 7638400 |
| 4 | |
Fariborz Jahanian | 264e159 | 2010-02-16 22:13:48 +0000 | [diff] [blame] | 5 | typedef void * id; |
Fariborz Jahanian | 86aa9fd | 2010-02-24 01:25:40 +0000 | [diff] [blame] | 6 | void *sel_registerName(const char *); |
Fariborz Jahanian | 264e159 | 2010-02-16 22:13:48 +0000 | [diff] [blame] | 7 | |
Fariborz Jahanian | 52b2e1e | 2010-02-12 17:52:31 +0000 | [diff] [blame] | 8 | @interface X |
| 9 | @end |
| 10 | |
| 11 | void foo(void (^block)(int)); |
| 12 | |
| 13 | @implementation X |
| 14 | static void enumerateIt(void (^block)(id, id, char *)) { |
| 15 | foo(^(int idx) { }); |
| 16 | } |
| 17 | @end |
| 18 | |
Fariborz Jahanian | 210c248 | 2010-02-16 17:26:03 +0000 | [diff] [blame] | 19 | // radar 7651312 |
| 20 | void apply(void (^block)(int)); |
| 21 | |
| 22 | static void x(int (^cmp)(int, int)) { |
| 23 | x(cmp); |
| 24 | } |
| 25 | |
| 26 | static void y(int (^cmp)(int, int)) { |
| 27 | apply(^(int sect) { |
| 28 | x(cmp); |
| 29 | }); |
| 30 | } |
Fariborz Jahanian | afad76f | 2010-02-18 01:20:22 +0000 | [diff] [blame] | 31 | |
| 32 | // radar 7659483 |
| 33 | void *_Block_copy(const void *aBlock); |
| 34 | void x(void (^block)(void)) { |
| 35 | block = ((__typeof(block))_Block_copy((const void *)(block))); |
| 36 | } |
Fariborz Jahanian | 86aa9fd | 2010-02-24 01:25:40 +0000 | [diff] [blame] | 37 | |
Fariborz Jahanian | 170ee0c | 2010-02-24 01:37:04 +0000 | [diff] [blame] | 38 | // radar 7682763 |
Fariborz Jahanian | 86aa9fd | 2010-02-24 01:25:40 +0000 | [diff] [blame] | 39 | @interface Y { |
| 40 | @private |
| 41 | id _private; |
| 42 | } |
| 43 | - (void (^)(void))f; |
| 44 | @end |
| 45 | |
| 46 | typedef void (^void_block_t)(void); |
| 47 | |
| 48 | @interface YY { |
| 49 | void_block_t __completion; |
| 50 | } |
| 51 | @property (copy) void_block_t f; |
| 52 | @end |
| 53 | |
| 54 | @implementation Y |
| 55 | - (void (^)(void))f { |
| 56 | return [_private f]; |
| 57 | } |
| 58 | |
| 59 | @end |
| 60 | |
Fariborz Jahanian | e985d01 | 2010-11-03 23:29:24 +0000 | [diff] [blame] | 61 | // rdar: //8608902 |
| 62 | @protocol CoreDAVAccountInfoProvider; |
| 63 | @protocol CodeProvider; |
| 64 | typedef void (^BDVDiscoveryCompletionHandler)(int success, id<CoreDAVAccountInfoProvider> discoveredInfo); |
| 65 | typedef void (^BDVDiscoveryCompletion)(id<CodeProvider> codeInfo, int success, id<CoreDAVAccountInfoProvider> discoveredInfo); |
| 66 | typedef void (^BDVDiscovery)(int success); |
| 67 | typedef void (^BDVDisc)(id<CoreDAVAccountInfoProvider> discoveredInfo, id<CodeProvider> codeInfo, |
| 68 | int success, id<CoreDAVAccountInfoProvider, CodeProvider> Info); |
| 69 | typedef void (^BLOCK)(id, id<CoreDAVAccountInfoProvider>, id<CodeProvider> codeInfo); |
| 70 | typedef void (^EMPTY_BLOCK)(); |
| 71 | typedef void (^ BDVDiscoveryCompletion1 )(id<CodeProvider> codeInfo, int success, id<CoreDAVAccountInfoProvider> discoveredInfo); |
| 72 | |
| 73 | void (^BL)(void(^arg1)(), int i1, void(^arg)(int)); |
| 74 | |
| 75 | typedef void (^iscoveryCompletionHandler)(void(^arg1)(), id<CoreDAVAccountInfoProvider> discoveredInfo); |
| 76 | |
| 77 | typedef void (^DVDisc)(id<CoreDAVAccountInfoProvider> discoveredInfo, id<CodeProvider> codeInfo, |
| 78 | void(^arg1)(), int i1, void(^arg)(id<CoreDAVAccountInfoProvider>), |
| 79 | int success, id<CoreDAVAccountInfoProvider, CodeProvider> Info); |
| 80 | |
Fariborz Jahanian | 06de2cf | 2010-11-03 23:50:34 +0000 | [diff] [blame] | 81 | |
| 82 | @interface I @end |
| 83 | @interface INTF @end |
| 84 | void (^BLINT)(I<CoreDAVAccountInfoProvider>* ARG, INTF<CodeProvider, CoreDAVAccountInfoProvider>* ARG1); |
Fariborz Jahanian | 8188e5f | 2010-11-05 18:34:46 +0000 | [diff] [blame^] | 85 | |
| 86 | void test8608902() { |
| 87 | BDVDiscoveryCompletionHandler ppp; |
| 88 | ppp(1, 0); |
| 89 | } |
| 90 | |