diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-04-03 11:08:00 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2007-04-03 11:08:00 +0200 |
commit | df3473facbac90274ca6e5d6e6ce3db2152dce35 (patch) | |
tree | 2278f06f550aeb7aeabbae2ccf061eabc975882e /gcc/cp | |
parent | 0a9430a8312d9f5a3795747773796b21d3bfe526 (diff) | |
download | gcc-df3473facbac90274ca6e5d6e6ce3db2152dce35.zip gcc-df3473facbac90274ca6e5d6e6ce3db2152dce35.tar.gz gcc-df3473facbac90274ca6e5d6e6ce3db2152dce35.tar.bz2 |
re PR c++/30847 (ICE with invalid statement expression)
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.
From-SVN: r123456
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 755115e..192d7e8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2007-04-03 Jakub Jelinek <jakub@redhat.com> + + PR c++/30847 + * typeck.c (build_modify_expr): For COND_EXPR on LHS, if RHS has void + type issue error and return early. + 2007-03-30 Jason Merrill <jason@redhat.com> PR c++/31187 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index a5a3345..f3358c7 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5702,6 +5702,12 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) tree cond; tree preeval = NULL_TREE; + if (VOID_TYPE_P (TREE_TYPE (rhs))) + { + error ("void value not ignored as it ought to be"); + return error_mark_node; + } + rhs = stabilize_expr (rhs, &preeval); /* Check this here to avoid odd errors when trying to convert |