comparison gcc/testsuite/gcc.dg/c99-array-lval-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Test for non-lvalue arrays decaying to pointers: in C99 only. */
2 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3 /* { dg-do compile } */
4 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
5
6 struct s { char c[1]; };
7
8 extern struct s foo (void);
9
10 void
11 bar (void)
12 {
13 char *t;
14 (foo ()).c[0]; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" } */
15 t = (foo ()).c; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" } */
16 (foo ()).c + 1; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" } */
17 }