llvm-project
43 строки · 817.0 Байт
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//
7// nestedimport.m
8// testObjects
9//
10// Created by Blaine Garst on 6/24/08.
11//
12// pure C nothing more needed
13// CONFIG
14
15
16#include <stdio.h>17#include <stdlib.h>18
19
20int Global = 0;21
22void callVoidVoid(void (^closure)(void)) {23closure();24}
25
26int main(int argc, char *argv[]) {27int i = 1;28
29void (^vv)(void) = ^{30if (argc > 0) {31callVoidVoid(^{ Global = i; });32}33};34
35i = 2;36vv();37if (Global != 1) {38printf("%s: error, Global not set to captured value\n", argv[0]);39exit(1);40}41printf("%s: success\n", argv[0]);42return 0;43}
44