1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp 2*f4a2713aSLionel Sambuc// 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*f4a2713aSLionel Sambuc// rdar://11202764 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambuctypedef void(^BL)(void); 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambucid return_id(void(^block)(void)) { 8*f4a2713aSLionel Sambuc return block; 9*f4a2713aSLionel Sambuc} 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel SambucBL return_block(id obj) { 12*f4a2713aSLionel Sambuc return obj; 13*f4a2713aSLionel Sambuc} 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambucint main() 16*f4a2713aSLionel Sambuc{ 17*f4a2713aSLionel Sambuc void(^block)(void); 18*f4a2713aSLionel Sambuc id obj; 19*f4a2713aSLionel Sambuc block = obj; // AnyPointerToBlockPointerCast 20*f4a2713aSLionel Sambuc obj = block; // BlockPointerToObjCPointerCast 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambuc id obj1 = block; 23*f4a2713aSLionel Sambuc 24*f4a2713aSLionel Sambuc void(^block1)(void) = obj1; 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc return_id(block1); 27*f4a2713aSLionel Sambuc 28*f4a2713aSLionel Sambuc return_id(obj1); 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc return_block(block1); 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambuc return_block(obj1); 33*f4a2713aSLionel Sambuc} 34