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-exception
10 * Created by Blaine Garst on 11/3/08.
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 values
22 enum { LESS
= -1, EQUAL
, GREATER
};
24 void sortWithBlock(long (^comp
)(void *arg1
, void *arg2
)) {
27 int 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
;
33 printf("%s: Success\n", argv
[0]);