2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / c99-array-lval-5.c
blob57e806d97d530923ac16bc2cd8d87cac9bf5efe2
1 /* Test for non-lvalue arrays: test that the unary '&' operator is not
2 allowed on them, for both C90 and C99. */
4 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
5 /* { dg-do compile } */
6 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
8 struct s { char c[1]; };
10 extern struct s foo (void);
11 struct s a, b, c;
12 int d;
14 void
15 bar (void)
17 &((foo ()).c); /* { dg-bogus "warning" "warning in place of error" } */
18 &((d ? b : c).c); /* { dg-bogus "warning" "warning in place of error" } */
19 &((d, b).c); /* { dg-bogus "warning" "warning in place of error" } */
20 &((a = b).c); /* { dg-bogus "warning" "warning in place of error" } */
22 /* { dg-error "lvalue" "bad address-of" { target *-*-* } 17 }
23 { dg-error "lvalue" "bad address-of" { target *-*-* } 18 }
24 { dg-error "lvalue" "bad address-of" { target *-*-* } 19 }
25 { dg-error "lvalue" "bad address-of" { target *-*-* } 20 }