Commit f2be060f by Jakub Jelinek Committed by Jakub Jelinek

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
parent b397e31b
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> 2008-04-28 Jason Merrill <jason@redhat.com>
Liu Guanwei <liu_gw@163.com> Liu Guanwei <liu_gw@163.com>
......
...@@ -5945,10 +5945,11 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs, ...@@ -5945,10 +5945,11 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
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, newrhs = cp_build_modify_expr (TREE_OPERAND (lhs, 0),
lhs, modifycode, rhs, complain);
cp_build_modify_expr (TREE_OPERAND (lhs, 0), if (newrhs == error_mark_node)
modifycode, rhs, complain)); return error_mark_node;
return build2 (COMPOUND_EXPR, lhstype, lhs, newrhs);
/* Handle (a, b) used as an "lvalue". */ /* Handle (a, b) used as an "lvalue". */
case COMPOUND_EXPR: case COMPOUND_EXPR:
......
2008-04-29 Jakub Jelinek <jakub@redhat.com>
PR c++/35987
* g++.dg/other/error28.C: New test.
2008-04-28 Uros Bizjak <ubizjak@gmail.com> 2008-04-28 Uros Bizjak <ubizjak@gmail.com>
PR target/36073 PR target/36073
// PR c++/35987
// { dg-do compile }
void
foo (char *p)
{
if (++p = true); // { dg-error "cannot convert" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment