Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc %s -fsyntax-only -verify -std=c89 |
Chris Lattner | 080b332 | 2008-07-25 20:02:29 +0000 | [diff] [blame] | 2 | // rdar://6095180 |
| 3 | |
Chris Lattner | 080b332 | 2008-07-25 20:02:29 +0000 | [diff] [blame] | 4 | struct s { char c[17]; }; |
Chris Lattner | 53fcaa9 | 2008-07-25 20:54:07 +0000 | [diff] [blame] | 5 | extern struct s foo(void); |
Chris Lattner | 080b332 | 2008-07-25 20:02:29 +0000 | [diff] [blame] | 6 | |
Chris Lattner | 53fcaa9 | 2008-07-25 20:54:07 +0000 | [diff] [blame] | 7 | struct s a, b, c; |
Chris Lattner | 080b332 | 2008-07-25 20:02:29 +0000 | [diff] [blame] | 8 | |
Chris Lattner | 53fcaa9 | 2008-07-25 20:54:07 +0000 | [diff] [blame] | 9 | int A[sizeof((foo().c)) == 17 ? 1 : -1]; |
| 10 | int B[sizeof((a.c)) == 17 ? 1 : -1]; |
| 11 | |
| 12 | |
Chris Lattner | 67d33d8 | 2008-07-25 21:33:13 +0000 | [diff] [blame] | 13 | // comma does not promote array/function in c90 unless they are lvalues. |
| 14 | int W[sizeof(0, a.c) == sizeof(char*) ? 1 : -1]; |
| 15 | int X[sizeof(0, (foo().c)) == 17 ? 1 : -1]; |
| 16 | int Y[sizeof(0, (a,b).c) == 17 ? 1 : -1]; |
| 17 | int Z[sizeof(0, (a=b).c) == 17 ? 1 : -1]; |