gcc/testsuite/gcc.dg/c90-array-lval-8.c
raw| 1 | /* Test for non-lvalue arrays: test that they cannot be assigned to |
| 2 | array variables. PR 58235. */ |
| 3 | /* { dg-do compile } */ |
| 4 | /* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ |
| 5 | |
| 6 | struct s { char c[1]; } x; |
| 7 | struct s f (void) { return x; } |
| 8 | |
| 9 | void |
| 10 | g (void) |
| 11 | { |
| 12 | char c[1]; |
| 13 | c = f ().c; /* { dg-error "array" } */ |
| 14 | } |
| 15 | |
| 16 | void |
| 17 | h (void) |
| 18 | { |
| 19 | char c[1] = f ().c; /* { dg-error "array" } */ |
| 20 | } |