• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
foo(void)17 void foo(void) { printf("I'm in foo\n"); }
bar(void)18 void bar(void) { printf("I'm in bar\n"); }
19 
main(int argc,char * argv[])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;
27 }
28