diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-03 09:08:00 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-03 09:08:00 +0000 |
commit | 76008ac42aa83a8051d9cf9d9e2106099aec90df (patch) | |
tree | 2278f06f550aeb7aeabbae2ccf061eabc975882e /gcc/testsuite/g++.dg/parse | |
parent | f83924bb910b9eb3c5c313de0cfdf8ba042cb291 (diff) | |
download | gcc-76008ac42aa83a8051d9cf9d9e2106099aec90df.tar.gz |
PR c++/30847
* typeck.c (build_modify_expr): For COND_EXPR on LHS, if RHS has void
type issue error and return early.
* g++.dg/parse/cond3.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123456 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg/parse')
-rw-r--r-- | gcc/testsuite/g++.dg/parse/cond3.C | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/parse/cond3.C b/gcc/testsuite/g++.dg/parse/cond3.C new file mode 100644 index 00000000000..96d9c1e3b5f --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/cond3.C @@ -0,0 +1,15 @@ +// PR c++/30847 +// { dg-do compile } +// { dg-options "" } + +int j, k, l; +extern void baz (); + +void +foo (int i) +{ + (i ? j : k) = ({ l++; (void) l; }); // { dg-error "void value not ignored" } + (i ? j : k) += ({ l++; (void) l; }); // { dg-error "void value not ignored" } + (i ? j : k) = baz (); // { dg-error "void value not ignored" } + (i ? j : k) *= baz (); // { dg-error "void value not ignored" } +} |