OSDN Git Service

Index: libcpp/ChangeLog
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / c90-array-lval-5.c
1 /* Test for non-lvalue arrays: test that the unary '&' operator is not
2    allowed on them, for both C90 and C99.  */
3
4 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
5 /* { dg-do compile } */
6 /* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
7
8 struct s { char c[1]; };
9
10 extern struct s foo (void);
11 struct s a, b, c;
12 int d;
13
14 void
15 bar (void)
16 {
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" } */
21 }
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 }
26 */