44 lines · c
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-exception5 6//7// nestedimport.m8// testObjects9//10// Created by Blaine Garst on 6/24/08.11//12// pure C nothing more needed13// CONFIG 14 15 16#include <stdio.h>17#include <stdlib.h>18 19 20int Global = 0;21 22void callVoidVoid(void (^closure)(void)) {23 closure();24}25 26int main(int argc, char *argv[]) {27 int i = 1;28 29 void (^vv)(void) = ^{30 if (argc > 0) {31 callVoidVoid(^{ Global = i; });32 }33 };34 35 i = 2;36 vv();37 if (Global != 1) {38 printf("%s: error, Global not set to captured value\n", argv[0]);39 exit(1);40 }41 printf("%s: success\n", argv[0]);42 return 0;43}44