Commit c0bcacec by Volker Reichelt Committed by Volker Reichelt

re PR c/27721 (ICE using += with a function)

	PR c/27721
	* c-typeck.c (build_modify_expr): Test earlier for non-lvalues.

	* gcc.dg/lvalue-4.c: New test.

From-SVN: r115955
parent 85cad37c
2006-08-05 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c/27721
* c-typeck.c (build_modify_expr): Test earlier for non-lvalues.
PR c/28136
* c-parser.c (c_parser_postfix_expression_after_paren_type): Robustify.
......
......@@ -3668,6 +3668,9 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
if (TREE_CODE (lhs) == ERROR_MARK || TREE_CODE (rhs) == ERROR_MARK)
return error_mark_node;
if (!lvalue_or_else (lhs, lv_assign))
return error_mark_node;
STRIP_TYPE_NOPS (rhs);
newrhs = rhs;
......@@ -3681,9 +3684,6 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
newrhs = build_binary_op (modifycode, lhs, rhs, 1);
}
if (!lvalue_or_else (lhs, lv_assign))
return error_mark_node;
/* Give an error for storing in something that is 'const'. */
if (TREE_READONLY (lhs) || TYPE_READONLY (lhstype)
......
2006-08-05 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c/27721
* gcc.dg/lvalue-4.c: New test.
PR c/28136
* gcc.dg/init-bad-5.c: New test.
/* PR c/27721 */
/* { dg-do compile } */
void foo()
{
int i();
i += 0; /* { dg-error "lvalue required" } */
}
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