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