1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -fblocks -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s 2*f4a2713aSLionel Sambuc // rdar://8594790 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc extern "C" { 5*f4a2713aSLionel Sambuc extern "C" void *_Block_copy(const void *aBlock); 6*f4a2713aSLionel Sambuc extern "C" void _Block_release(const void *aBlock); 7*f4a2713aSLionel Sambuc } 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc class A { 10*f4a2713aSLionel Sambuc public: 11*f4a2713aSLionel Sambuc int x; 12*f4a2713aSLionel Sambuc A(const A &o); 13*f4a2713aSLionel Sambuc A(); 14*f4a2713aSLionel Sambuc virtual ~A(); 15*f4a2713aSLionel Sambuc void hello() const; 16*f4a2713aSLionel Sambuc }; 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc int main()19*f4a2713aSLionel Sambucmain() 20*f4a2713aSLionel Sambuc { 21*f4a2713aSLionel Sambuc A a; 22*f4a2713aSLionel Sambuc void (^c)(void) = ((__typeof(^{ a.hello(); }))_Block_copy((const void *)(^{ a.hello(); }))); 23*f4a2713aSLionel Sambuc c(); 24*f4a2713aSLionel Sambuc _Block_release((const void *)(c)); 25*f4a2713aSLionel Sambuc return 0; 26*f4a2713aSLionel Sambuc } 27*f4a2713aSLionel Sambuc 28*f4a2713aSLionel Sambuc // CHECK-LABEL: define internal void @__copy_helper_block_ 29*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1AC1ERKS_ 30*f4a2713aSLionel Sambuc 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambuc // CHECK-LABEL:define internal void @__destroy_helper_block_ 33*f4a2713aSLionel Sambuc // CHECK: call void @_ZN1AD1Ev 34