Home | History | Annotate | Download | only in BlocksRuntime
      1 //
      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 
     18 void foo(void) { printf("I'm in foo\n"); }
     19 void bar(void) { printf("I'm in bar\n"); }
     20 
     21 int 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 }
     29