Blaine Garst | 86d0ba4 | 2010-08-04 23:34:21 +0000 | [diff] [blame] | 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 | // -*- mode:C; c-basic-offset:4; tab-width:4; intent-tabs-mode:nil; -*- |
| 8 | // CONFIG error: incompatible block pointer types assigning |
| 9 | |
| 10 | #import <stdio.h> |
| 11 | #import <stdlib.h> |
| 12 | |
| 13 | int main(int argc, char *argv[]) { |
| 14 | #ifndef __cplusplus |
| 15 | char (^rot13)(); |
| 16 | rot13 = ^(char c) { return (char)(((c - 'a' + 13) % 26) + 'a'); }; |
| 17 | char n = rot13('a'); |
| 18 | char c = rot13('p'); |
| 19 | if ( n != 'n' || c != 'c' ) { |
| 20 | printf("%s: rot13('a') returned %c, rot13('p') returns %c\n", argv[0], n, c); |
| 21 | exit(1); |
| 22 | } |
| 23 | #else |
| 24 | // yield characteristic error message for C++ |
| 25 | #error incompatible block pointer types assigning |
| 26 | #endif |
| 27 | #ifndef __clang__ |
| 28 | // yield characteristic error message for C++ |
| 29 | #error incompatible block pointer types assigning |
| 30 | #endif |
| 31 | printf("%s: success\n", argv[0]); |
| 32 | exit(0); |
| 33 | } |