xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/block.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-llvm -o - -fblocks
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -triple %ms_abi_triple -fno-rtti -emit-llvm -o - -fblocks
3f4a2713aSLionel Sambuc // Just test that this doesn't crash the compiler...
4f4a2713aSLionel Sambuc 
5f4a2713aSLionel Sambuc void func(void*);
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc struct Test
8f4a2713aSLionel Sambuc {
useTest9f4a2713aSLionel Sambuc   virtual void use() { func((void*)this); }
TestTest10f4a2713aSLionel Sambuc   Test(Test&c) { func((void*)this); }
TestTest11f4a2713aSLionel Sambuc   Test() { func((void*)this); }
12f4a2713aSLionel Sambuc };
13f4a2713aSLionel Sambuc 
14f4a2713aSLionel Sambuc void useBlock(void (^)(void));
15f4a2713aSLionel Sambuc 
main(void)16f4a2713aSLionel Sambuc int main (void) {
17f4a2713aSLionel Sambuc   __block Test t;
18f4a2713aSLionel Sambuc   useBlock(^(void) { t.use(); });
19f4a2713aSLionel Sambuc }
20f4a2713aSLionel Sambuc 
21