Fariborz Jahanian | f1ee687 | 2012-04-10 00:08:18 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp |
| 2 | // RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp |
| 3 | // rdar://11202764 |
Fariborz Jahanian | f1ee687 | 2012-04-10 00:08:18 +0000 | [diff] [blame] | 4 | |
| 5 | typedef void(^BL)(void); |
| 6 | |
| 7 | id return_id(void(^block)(void)) { |
| 8 | return block; |
| 9 | } |
| 10 | |
| 11 | BL return_block(id obj) { |
| 12 | return obj; |
| 13 | } |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | void(^block)(void); |
| 18 | id obj; |
| 19 | block = obj; // AnyPointerToBlockPointerCast |
| 20 | obj = block; // BlockPointerToObjCPointerCast |
| 21 | |
| 22 | id obj1 = block; |
| 23 | |
| 24 | void(^block1)(void) = obj1; |
| 25 | |
| 26 | return_id(block1); |
| 27 | |
| 28 | return_id(obj1); |
| 29 | |
| 30 | return_block(block1); |
| 31 | |
| 32 | return_block(obj1); |
| 33 | } |