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 * copynull.c
8 * testObjects
9 *
10 * Created by Blaine Garst on 10/15/08.
11 *
12 */
13
14#import <stdio.h>
15#import <Block.h>
16#import <Block_private.h>
17
18// CONFIG rdar://6295848
19
20int main(int argc, char *argv[]) {
21
22 void (^block)(void) = (void (^)(void))0;
23 void (^blockcopy)(void) = Block_copy(block);
24
25 if (blockcopy != (void (^)(void))0) {
26 printf(format: "whoops, somehow we copied NULL!\n");
27 return 1;
28 }
29 // make sure we can also
30 Block_release(blockcopy);
31 // and more secretly
32 //_Block_destroy(blockcopy);
33
34 printf(format: "%s: success\n", argv[0]);
35 return 0;
36}
37

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