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  *  rettypepromotion.c
      9  *  testObjects
     10  *
     11  *  Created by Blaine Garst on 11/3/08.
     12  *
     13  */
     14 
     15 // CONFIG error:
     16 // C++ and C give different errors so we don't check for an exact match.
     17 // The error is that enum's are defined to be ints, always, even if defined with explicit long values
     18 
     19 
     20 #include <stdio.h>
     21 #include <stdlib.h>
     22 
     23 enum { LESS = -1, EQUAL, GREATER };
     24 
     25 void sortWithBlock(long (^comp)(void *arg1, void *arg2)) {
     26 }
     27 
     28 int main(int argc, char *argv[]) {
     29     sortWithBlock(^(void *arg1, void *arg2) {
     30         if (random()) return LESS;
     31         if (random()) return EQUAL;
     32         if (random()) return GREATER;
     33     });
     34     printf("%s: Success\n", argv[0]);
     35     return 0;
     36 }
     37