Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / BlocksRuntime / k-and-r.c
blob2661eece37f926dcc9add7dd0606cd89104afc6b
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-exception
6 // -*- mode:C; c-basic-offset:4; tab-width:4; intent-tabs-mode:nil; -*-
7 // CONFIG error: incompatible block pointer types assigning
9 #import <stdio.h>
10 #import <stdlib.h>
12 int main(int argc, char *argv[]) {
13 #ifndef __cplusplus
14 char (^rot13)();
15 rot13 = ^(char c) { return (char)(((c - 'a' + 13) % 26) + 'a'); };
16 char n = rot13('a');
17 char c = rot13('p');
18 if ( n != 'n' || c != 'c' ) {
19 printf("%s: rot13('a') returned %c, rot13('p') returns %c\n", argv[0], n, c);
20 exit(1);
22 #else
23 // yield characteristic error message for C++
24 #error incompatible block pointer types assigning
25 #endif
26 #ifndef __clang__
27 // yield characteristic error message for C++
28 #error incompatible block pointer types assigning
29 #endif
30 printf("%s: success\n", argv[0]);
31 exit(0);