xref: /llvm-project/compiler-rt/test/BlocksRuntime/rdar6396238.c (revision 2946cd701067404b99c39fb29dc9c74bd7193eb3)
1 //
2 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3 // See https://llvm.org/LICENSE.txt for license information.
4 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 
6 // CONFIG rdar://6396238
7 
8 #include <stdio.h>
9 #include <stdlib.h>
10 
11 static int count = 0;
12 
mkblock(void)13 void (^mkblock(void))(void)
14 {
15     count++;
16     return ^{
17         count++;
18     };
19 }
20 
main(int argc,const char * argv[])21 int main (int argc, const char * argv[]) {
22     mkblock()();
23     if (count != 2) {
24         printf("%s: failure, 2 != %d\n", argv[0], count);
25         exit(1);
26     } else {
27         printf("%s: success\n", argv[0]);
28         exit(0);
29     }
30     return 0;
31 }
32