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