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
11static int count = 0;
12
13void (^mkblock(void))(void)
14{
15 count++;
16 return ^{
17 count++;
18 };
19}
20
21int main (int argc, const char * argv[]) {
22 mkblock()();
23 if (count != 2) {
24 printf(format: "%s: failure, 2 != %d\n", argv[0], count);
25 exit(status: 1);
26 } else {
27 printf(format: "%s: success\n", argv[0]);
28 exit(status: 0);
29 }
30 return 0;
31}
32

source code of compiler-rt/test/BlocksRuntime/rdar6396238.c