aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-04-04 12:42:39 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-04-04 12:42:39 -0400
commit7447f1d7e21fbebd7ddaf9865bf05104592f3049 (patch)
treed38e68c772f18182e95d4c2f25e593959a7f2872 /gcc
parent239209c4c45b16724b704e68ef8b949d806d3121 (diff)
downloadgcc-7447f1d7e21fbebd7ddaf9865bf05104592f3049.zip
gcc-7447f1d7e21fbebd7ddaf9865bf05104592f3049.tar.gz
gcc-7447f1d7e21fbebd7ddaf9865bf05104592f3049.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/testsuite/g++.dg/expr/assign2.C12
-rw-r--r--gcc/testsuite/g++.dg/parse/crash60.C2
4 files changed, 18 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 61483a5..8ab7cce 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
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.
* tree.c (replace_placeholders_r): Use handled_component_p.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 2b7a771..e5ad54d 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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
operator. -- end note ] */
lhs = cp_stabilize_reference (lhs);
- rhs = rvalue (rhs);
+ rhs = decay_conversion (rhs, complain);
if (rhs == error_mark_node)
return error_mark_node;
rhs = stabilize_expr (rhs, &init);
diff --git a/gcc/testsuite/g++.dg/expr/assign2.C b/gcc/testsuite/g++.dg/expr/assign2.C
new file mode 100644
index 0000000..759584a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/assign2.C
@@ -0,0 +1,12 @@
+// PR c++/85141
+// { dg-options "-w -fpermissive" }
+
+struct A
+{
+ static int foo();
+};
+
+void bar(int i)
+{
+ i += A().foo;
+}
diff --git a/gcc/testsuite/g++.dg/parse/crash60.C b/gcc/testsuite/g++.dg/parse/crash60.C
index e515396..8e545a2 100644
--- a/gcc/testsuite/g++.dg/parse/crash60.C
+++ b/gcc/testsuite/g++.dg/parse/crash60.C
@@ -10,5 +10,5 @@ void foo()
int result = 0;
M m;
- result += m.pop(); // { dg-error "invalid operands|in evaluation" }
+ result += m.pop(); // { dg-error "" }
}