Commit 7447f1d7 by Jason Merrill Committed by Jason Merrill

PR c++/85141 - ICE with compound assignment and static member fn.

	* typeck.c (cp_build_modify_expr): Call decay_conversion for RHS of
	compound assignment.

From-SVN: r259089
parent 239209c4
2018-04-04 Jason Merrill <jason@redhat.com> 2018-04-04 Jason Merrill <jason@redhat.com>
PR c++/85141 - ICE with compound assignment and static member fn.
* typeck.c (cp_build_modify_expr): Call decay_conversion for RHS of
compound assignment.
PR c++/85148 - ICE with 'this' in array NSDMI. PR c++/85148 - ICE with 'this' in array NSDMI.
* tree.c (replace_placeholders_r): Use handled_component_p. * tree.c (replace_placeholders_r): Use handled_component_p.
......
...@@ -8083,7 +8083,7 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode, ...@@ -8083,7 +8083,7 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
side effect associated with any single compound assignment side effect associated with any single compound assignment
operator. -- end note ] */ operator. -- end note ] */
lhs = cp_stabilize_reference (lhs); lhs = cp_stabilize_reference (lhs);
rhs = rvalue (rhs); rhs = decay_conversion (rhs, complain);
if (rhs == error_mark_node) if (rhs == error_mark_node)
return error_mark_node; return error_mark_node;
rhs = stabilize_expr (rhs, &init); rhs = stabilize_expr (rhs, &init);
......
// PR c++/85141
// { dg-options "-w -fpermissive" }
struct A
{
static int foo();
};
void bar(int i)
{
i += A().foo;
}
...@@ -10,5 +10,5 @@ void foo() ...@@ -10,5 +10,5 @@ void foo()
int result = 0; int result = 0;
M m; M m;
result += m.pop(); // { dg-error "invalid operands|in evaluation" } result += m.pop(); // { dg-error "" }
} }
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