This commit is contained in:
Jakub Jelinek 2008-04-28 15:26:55 +00:00
parent 02167d8fc9
commit 9dd31b0ca8

View File

@ -1,23 +1,23 @@
2008-04-21 Jakub Jelinek <jakub@redhat.com> 2008-04-21 Jakub Jelinek <jakub@redhat.com>
PR c++/35987 PR c++/35987
* typeck.c (cp_build_modify_expr) <case PREINCREMENT_EXPR>: Don't build * typeck.c (build_modify_expr) <case PREINCREMENT_EXPR>: Don't build
COMPOUND_EXPR if the second argument would be error_mark_node. COMPOUND_EXPR if the second argument would be error_mark_node.
* g++.dg/other/error28.C: New test. * g++.dg/other/error28.C: New test.
--- gcc/cp/typeck.c.jj 2008-04-18 17:00:44.000000000 +0200 --- gcc/cp/typeck.c.jj 2008-04-18 17:00:44.000000000 +0200
+++ gcc/cp/typeck.c 2008-04-21 16:03:45.000000000 +0200 +++ gcc/cp/typeck.c 2008-04-21 16:03:45.000000000 +0200
@@ -5940,10 +5940,11 @@ cp_build_modify_expr (tree lhs, enum tre @@ -5667,10 +5667,11 @@ build_modify_expr (tree lhs, enum tree_c
lhs = build2 (TREE_CODE (lhs), TREE_TYPE (lhs), lhs = build2 (TREE_CODE (lhs), TREE_TYPE (lhs),
stabilize_reference (TREE_OPERAND (lhs, 0)), stabilize_reference (TREE_OPERAND (lhs, 0)),
TREE_OPERAND (lhs, 1)); TREE_OPERAND (lhs, 1));
- return build2 (COMPOUND_EXPR, lhstype, - return build2 (COMPOUND_EXPR, lhstype,
- lhs, - lhs,
- cp_build_modify_expr (TREE_OPERAND (lhs, 0), - build_modify_expr (TREE_OPERAND (lhs, 0),
- modifycode, rhs, complain)); - modifycode, rhs));
+ newrhs = cp_build_modify_expr (TREE_OPERAND (lhs, 0), + newrhs = build_modify_expr (TREE_OPERAND (lhs, 0),
+ modifycode, rhs, complain); + modifycode, rhs);
+ if (newrhs == error_mark_node) + if (newrhs == error_mark_node)
+ return error_mark_node; + return error_mark_node;
+ return build2 (COMPOUND_EXPR, lhstype, lhs, newrhs); + return build2 (COMPOUND_EXPR, lhstype, lhs, newrhs);