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 | // constassign.c |
8 | // bocktest |
9 | // |
10 | // Created by Blaine Garst on 3/21/08. |
11 | // |
12 | // shouldn't be able to assign to a const pointer |
13 | // CONFIG error: assignment of read-only |
14 | |
15 | #import <stdio.h> |
16 | |
17 | void foo(void) { printf(format: "I'm in foo\n" ); } |
18 | void bar(void) { printf(format: "I'm in bar\n" ); } |
19 | |
20 | int main(int argc, char *argv[]) { |
21 | void (*const fptr)(void) = foo; |
22 | void (^const blockA)(void) = ^ { printf(format: "hello\n" ); }; |
23 | blockA = ^ { printf(format: "world\n" ); } ; |
24 | fptr = bar; |
25 | printf(format: "%s: success\n" , argv[0]); |
26 | return 0; |
27 | } |
28 | |