aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2018-11-26 23:26:40 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2018-11-26 23:26:40 +0000
commit2426ee774baaea8d4a447229830ac0f31c69ab25 (patch)
tree8ff280cb726ebe2a8d9b76fcf21cf63e0a51daa4 /gcc
parent80de5ef9c1070e6dcbf8fd5cae93b06edc36d08a (diff)
downloadgcc-2426ee774baaea8d4a447229830ac0f31c69ab25.zip
gcc-2426ee774baaea8d4a447229830ac0f31c69ab25.tar.gz
gcc-2426ee774baaea8d4a447229830ac0f31c69ab25.tar.bz2
PR c++/88120 - ICE when calling save_expr in a template.
* typeck.c (cp_build_binary_op): Call cp_save_expr instead of save_expr. * g++.dg/cpp0x/pr88120.C: New test. From-SVN: r266492
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr88120.C23
4 files changed, 35 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e870205..8e157f6 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2018-11-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/88120 - ICE when calling save_expr in a template.
+ * typeck.c (cp_build_binary_op): Call cp_save_expr instead of
+ save_expr.
+
2018-11-22 Jakub Jelinek <jakub@redhat.com>
PR c++/87386
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 81cb405..f45c06e 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4919,7 +4919,7 @@ cp_build_binary_op (location_t location,
tree pfn0, delta0, e1, e2;
if (TREE_SIDE_EFFECTS (op0))
- op0 = save_expr (op0);
+ op0 = cp_save_expr (op0);
pfn0 = pfn_from_ptrmemfunc (op0);
delta0 = delta_from_ptrmemfunc (op0);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 234885a..989b548 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/88120 - ICE when calling save_expr in a template.
+ * g++.dg/cpp0x/pr88120.C: New test.
+
2018-11-26 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* c-c++-common/Warray-bounds-3.c (test_strcpy_bounds): Use long instead
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr88120.C b/gcc/testsuite/g++.dg/cpp0x/pr88120.C
new file mode 100644
index 0000000..7004e03
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr88120.C
@@ -0,0 +1,23 @@
+// PR c++/88120
+// { dg-do compile { target c++11 } }
+
+typedef int a;
+enum b : a;
+class c {
+ enum f { d };
+ c(f);
+ friend c operator&(c, c);
+ typedef void (c::*e)();
+ operator e();
+};
+class g {
+ template <typename, typename> b h();
+ struct k {
+ c i;
+ };
+};
+template <typename, typename> b g::h() {
+ k j;
+ &j || j.i &c::d;
+ return b();
+}