Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / BlocksRuntime / constassign.c
blob932afce9bfc3e27b5f79efb6bbfa9ebdaf09c156
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
6 //
7 // constassign.c
8 // bocktest
9 //
10 // Created by Blaine Garst on 3/21/08.
12 // shouldn't be able to assign to a const pointer
13 // CONFIG error: assignment of read-only
15 #import <stdio.h>
17 void foo(void) { printf("I'm in foo\n"); }
18 void bar(void) { printf("I'm in bar\n"); }
20 int main(int argc, char *argv[]) {
21 void (*const fptr)(void) = foo;
22 void (^const blockA)(void) = ^ { printf("hello\n"); };
23 blockA = ^ { printf("world\n"); } ;
24 fptr = bar;
25 printf("%s: success\n", argv[0]);
26 return 0;