1 #include <stdio.h>
2
3 int
main()4 main() {
5 /*
6 * 03/03/09: Items of pointer type which are not backed
7 * by a real address are not properly handled by nwcc in
8 * constant expressions yet.
9 *
10 * (char *)0 + 3
11 *
12 * yields an error because this location in do_eval_const_expr():
13 *
14 *
15 * *
16 * * XXX we need more typechecking
17 * *
18 * if (tree->op == TOK_OP_PLUS
19 * || tree->op == TOK_OP_MINUS) {
20 * * Must be addr + integer *
21 *
22 * does not handle that case. The expression is bogus because
23 * (char *)0 is not a suitable address constant, but since it
24 * is really backed by an integer, it can be evaluated on all
25 * supported platforms anyway
26 */
27
28 static int foo = (int)((char *)0 + 3);
29 printf("%d\n", foo);
30 return 0;
31 }
32
33