diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-04-29 10:54:45 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-04-29 10:54:45 +0200 |
commit | f2be060fd3c04b05c22f3c75c1e32f5b1c7a0f43 (patch) | |
tree | c32099684fbe608cfcab212a16d22c8b3582d0c6 /gcc/cp | |
parent | b397e31bd8dcc8b2c112a57e7dca2785cdbf569f (diff) | |
download | gcc-f2be060fd3c04b05c22f3c75c1e32f5b1c7a0f43.zip gcc-f2be060fd3c04b05c22f3c75c1e32f5b1c7a0f43.tar.gz gcc-f2be060fd3c04b05c22f3c75c1e32f5b1c7a0f43.tar.bz2 |
re PR c++/35987 (ICE with invalid if-condition)
PR c++/35987
* typeck.c (cp_build_modify_expr) <case PREINCREMENT_EXPR>: Don't build
COMPOUND_EXPR if the second argument would be error_mark_node.
* g++.dg/other/error28.C: New test.
From-SVN: r134786
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 368348a3..15aa14c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-04-29 Jakub Jelinek <jakub@redhat.com> + + PR c++/35987 + * typeck.c (cp_build_modify_expr) <case PREINCREMENT_EXPR>: Don't build + COMPOUND_EXPR if the second argument would be error_mark_node. + 2008-04-28 Jason Merrill <jason@redhat.com> Liu Guanwei <liu_gw@163.com> diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 4277956..bf264ad 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5945,10 +5945,11 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs, lhs = build2 (TREE_CODE (lhs), TREE_TYPE (lhs), stabilize_reference (TREE_OPERAND (lhs, 0)), TREE_OPERAND (lhs, 1)); - return build2 (COMPOUND_EXPR, lhstype, - lhs, - cp_build_modify_expr (TREE_OPERAND (lhs, 0), - modifycode, rhs, complain)); + newrhs = cp_build_modify_expr (TREE_OPERAND (lhs, 0), + modifycode, rhs, complain); + if (newrhs == error_mark_node) + return error_mark_node; + return build2 (COMPOUND_EXPR, lhstype, lhs, newrhs); /* Handle (a, b) used as an "lvalue". */ case COMPOUND_EXPR: |