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
This commit is contained in:
parent
85cad37c81
commit
c0bcacec2d
|
@ -1,5 +1,8 @@
|
|||
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)
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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.
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/* PR c/27721 */
|
||||
/* { dg-do compile } */
|
||||
|
||||
void foo()
|
||||
{
|
||||
int i();
|
||||
i += 0; /* { dg-error "lvalue required" } */
|
||||
}
|
Loading…
Reference in New Issue