• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
4
5typedef void(^BL)(void);
6
7id return_id(void(^block)(void)) {
8  return block;
9}
10
11BL return_block(id obj) {
12  return obj;
13}
14
15int 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}
34