In gcc/testsuite/: 2011-03-04 Nicola Pero <nicola.pero@meta-innovation.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / c90-array-lval-7.c
blobee8da4c70fd89b8ca32094d9180a6d5de9ae7173
1 /* Test for non-lvalue arrays: test that C90 does not allow them in
2 conditional expressions, while in C99 they decay and are
3 allowed. */
5 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
6 /* { dg-do compile } */
7 /* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
9 struct s { char c[1]; };
10 struct s a, b, c;
11 int d;
12 int e;
14 void
15 bar (void)
17 /* In C90, the non-lvalue arrays do not decay to pointers, and
18 6.3.15 does not permit conditional expressions between arrays.
19 In C99, they decay to pointers. */
20 (e ? (d ? b : c).c : (e ? b : c).c); /* { dg-bogus "warning" "warning in place of error" } */
23 /* { dg-error "array" "bad conditional" { target *-*-* } 20 } */