diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-12-03 02:47:13 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-12-03 02:47:13 +0000 |
commit | 39f74d6673195737d5b8c6880b8c1ab9c1318cd2 (patch) | |
tree | eb299deee08e7335f846ed167c65364ef8d62b64 /gcc/testsuite/gcc.dg/c90-array-lval-8.c | |
parent | d47c8f3ebe87255a60f05566863585feeb91128d (diff) | |
download | gcc-39f74d6673195737d5b8c6880b8c1ab9c1318cd2.tar.gz |
PR c/58235
c:
* c-typeck.c (build_modify_expr): Diagnose assignment to
expression with array type.
testsuite:
* gcc.dg/c90-array-lval-8.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205615 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/c90-array-lval-8.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/c90-array-lval-8.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/c90-array-lval-8.c b/gcc/testsuite/gcc.dg/c90-array-lval-8.c new file mode 100644 index 00000000000..bc5b7b21b8a --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-array-lval-8.c @@ -0,0 +1,20 @@ +/* Test for non-lvalue arrays: test that they cannot be assigned to + array variables. PR 58235. */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +struct s { char c[1]; } x; +struct s f (void) { return x; } + +void +g (void) +{ + char c[1]; + c = f ().c; /* { dg-error "array" } */ +} + +void +h (void) +{ + char c[1] = f ().c; /* { dg-error "array" } */ +} |