Chris Lattner | 04de993 | 2008-12-12 07:01:24 +0000 | [diff] [blame] | 1 | // RUN: clang %s -fsyntax-only -verify -pedantic -fpascal-strings |
| 2 | |
| 3 | int a() {int p; *(1 ? &p : (void*)(0 && (a(),1))) = 10;} |
| 4 | |
| 5 | // rdar://6091492 - ?: with __builtin_constant_p as the operand is an i-c-e. |
| 6 | int expr; |
| 7 | char w[__builtin_constant_p(expr) ? expr : 1]; |
| 8 | |
| 9 | |
| 10 | |
| 11 | void test1(int n, int* p) { *(n ? p : (void *)(7-7)) = 1; } |
| 12 | void test2(int n, int* p) { *(n ? p : (void *)0) = 1; } |
| 13 | |
| 14 | |
| 15 | |
| 16 | char array[1024/(sizeof (long))]; |
| 17 | |
| 18 | int x['\xBb' == (char) 187 ? 1: -1]; |
| 19 | |
| 20 | // PR1992 |
| 21 | void func(int x) |
| 22 | { |
| 23 | switch (x) { |
| 24 | case sizeof("abc"): break; |
| 25 | case sizeof("loooong"): func(4); |
| 26 | case sizeof("\ploooong"): func(4); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | |
| 31 | // rdar://4213768 |
| 32 | int expr; |
| 33 | char y[__builtin_constant_p(expr) ? -1 : 1]; |
| 34 | char z[__builtin_constant_p(4) ? 1 : -1]; |
| 35 | |