blob: ff868fcdd06f5b6216ca62f2bc658186d121ff79 [file] [log] [blame]
Fariborz Jahaniane988bda2010-11-13 21:53:34 +00001// RUN: %clang_cc1 %s -fblocks -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
2// rdar://8594790
3
4extern "C" {
5extern "C" void *_Block_copy(const void *aBlock);
6extern "C" void _Block_release(const void *aBlock);
7}
8
9class A {
10public:
11 int x;
12 A(const A &o);
13 A();
14 virtual ~A();
15 void hello() const;
16};
17
18int
19main()
20{
21 A a;
22 void (^c)(void) = ((__typeof(^{ a.hello(); }))_Block_copy((const void *)(^{ a.hello(); })));
23 c();
24 _Block_release((const void *)(c));
25 return 0;
26}
27
Stephen Lin43622612013-08-15 06:47:53 +000028// CHECK-LABEL: define internal void @__copy_helper_block_
Fariborz Jahaniane988bda2010-11-13 21:53:34 +000029// CHECK: call void @_ZN1AC1ERKS_
30
31
Stephen Lin43622612013-08-15 06:47:53 +000032// CHECK-LABEL:define internal void @__destroy_helper_block_
Fariborz Jahaniane988bda2010-11-13 21:53:34 +000033// CHECK: call void @_ZN1AD1Ev