brintos

brintos / llvm-project-archived public Read only

0
0
Text · 769 B · 0044747 Raw
32 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#include <Block.h>7#include <stdio.h>8 9// CONFIG rdar://622580910// fixed in 562311 12int main(int argc, char *argv[]) {13    __block int a = 42;14    int* ap = &a; // just to keep the address on the stack.15 16    void (^b)(void) = ^{17        //a;              // workaround, a should be implicitly imported18        Block_copy(^{19            a = 2;20        });21    };22 23    Block_copy(b);24 25    if(&a == ap) {26        printf("**** __block heap storage should have been created at this point\n");27        return 1;28    }29    printf("%s: Success\n", argv[0]);30    return 0;31}32