1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -E %s -o %t.mm 2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %t.mm -o %t-rw.cpp 3*f4a2713aSLionel Sambuc// RUN: FileCheck -check-prefix CHECK-LP --input-file=%t-rw.cpp %s 4*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %t.mm -o %t-modern-rw.cpp 5*f4a2713aSLionel Sambuc// RUN: FileCheck -check-prefix CHECK-LP --input-file=%t-modern-rw.cpp %s 6*f4a2713aSLionel Sambuc// radar 7607781 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuctypedef struct { 9*f4a2713aSLionel Sambuc int a; 10*f4a2713aSLionel Sambuc int b; 11*f4a2713aSLionel Sambuc} mystruct; 12*f4a2713aSLionel Sambuc 13*f4a2713aSLionel Sambucvoid g(int (^block)(mystruct s)) { 14*f4a2713aSLionel Sambuc mystruct x; 15*f4a2713aSLionel Sambuc int v = block(x); 16*f4a2713aSLionel Sambuc} 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambucvoid f(const void **arg) { 19*f4a2713aSLionel Sambuc __block const void **q = arg; 20*f4a2713aSLionel Sambuc g(^(mystruct s){ 21*f4a2713aSLionel Sambuc *q++ = (void*)s.a; 22*f4a2713aSLionel Sambuc return 314; 23*f4a2713aSLionel Sambuc }); 24*f4a2713aSLionel Sambuc} 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc// CHECK-LP: (__Block_byref_q_0 *)&q 27