blob: 537cb2df059793d2c08def039c0e825cc9ab41aa [file] [log] [blame]
Blaine Garst86d0ba42010-08-04 23:34:21 +00001//
2// The LLVM Compiler Infrastructure
3//
4// This file is distributed under the University of Illinois Open Source
5// License. See LICENSE.TXT for details.
6
7//
8// constassign.c
9// bocktest
10//
11// Created by Blaine Garst on 3/21/08.
12//
13// shouldn't be able to assign to a const pointer
14// CONFIG error: assignment of read-only
15
16#import <stdio.h>
17
18void foo(void) { printf("I'm in foo\n"); }
19void bar(void) { printf("I'm in bar\n"); }
20
21int main(int argc, char *argv[]) {
22 void (*const fptr)(void) = foo;
23 void (^const blockA)(void) = ^ { printf("hello\n"); };
24 blockA = ^ { printf("world\n"); } ;
25 fptr = bar;
26 printf("%s: success\n", argv[0]);
27 return 0;
28}