28 lines · c
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-exception5 6//7// constassign.c8// bocktest9//10// Created by Blaine Garst on 3/21/08.11//12// shouldn't be able to assign to a const pointer13// CONFIG error: assignment of read-only14 15#import <stdio.h>16 17void foo(void) { printf("I'm in foo\n"); }18void bar(void) { printf("I'm in bar\n"); }19 20int 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