blob: 726b7cbb29fce7860cce568483418cf5d68798d9 [file] [log] [blame]
Eli Friedman7888b932008-11-12 09:44:48 +00001// RUN: clang -fsyntax-only -verify %s
2
3#define EVAL_EXPR(testno, expr) int test##testno = sizeof(struct{char qq[expr];});
4int x;
5EVAL_EXPR(1, (_Bool)&x)
6EVAL_EXPR(2, (int)(1.0+(double)4))
7EVAL_EXPR(3, (int)(1.0+(float)4.0))
8EVAL_EXPR(4, (_Bool)(1 ? (void*)&x : 0))
9EVAL_EXPR(5, (_Bool)(int[]){0})
10struct y {int x,y;};
11EVAL_EXPR(6, (int)(1+(struct y*)0))
12EVAL_EXPR(7, (int)&((struct y*)0)->y)
13EVAL_EXPR(8, (_Bool)"asdf")
Eli Friedman14cc7542008-11-13 06:09:17 +000014EVAL_EXPR(9, !!&x)
15EVAL_EXPR(10, ((void)1, 12))
16void g0(void);
17EVAL_EXPR(11, (g0(), 12)) // FIXME: This should give an error
18EVAL_EXPR(12, 1.0&&2.0)
19EVAL_EXPR(13, x || 3.0)