aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2017-03-06 17:38:42 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2017-03-06 17:38:42 +0000
commitbdbbf28d15945150b16406d1bce91db58a65ac08 (patch)
tree81b930f94647aecd7f58f630f327fa2ac045aea7 /gcc
parent52564551d3b21bc1cf08d87de8a0682764753c8a (diff)
downloadgcc-bdbbf28d15945150b16406d1bce91db58a65ac08.zip
gcc-bdbbf28d15945150b16406d1bce91db58a65ac08.tar.gz
gcc-bdbbf28d15945150b16406d1bce91db58a65ac08.tar.bz2
PR c++/79796 - ICE with NSDMI and this pointer
PR c++/79796 - ICE with NSDMI and this pointer * call.c (build_over_call): Handle NSDMI with a 'this' by calling replace_placeholders. * g++.dg/cpp0x/nsdmi13.C: New test. From-SVN: r245927
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nsdmi13.C13
4 files changed, 27 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 12d74a6..13350b8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2017-03-06 Marek Polacek <polacek@redhat.com>
+
+ PR c++/79796 - ICE with NSDMI and this pointer
+ * call.c (build_over_call): Handle NSDMI with a 'this' by calling
+ replace_placeholders.
+
2017-03-06 Jakub Jelinek <jakub@redhat.com>
PR c++/79822
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 5afec4f..86c7647 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -8047,6 +8047,9 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
{
arg = cp_build_indirect_ref (arg, RO_NULL, complain);
val = build2 (MODIFY_EXPR, TREE_TYPE (to), to, arg);
+ if (cxx_dialect >= cxx14)
+ /* Handle NSDMI that refer to the object being initialized. */
+ replace_placeholders (arg, to);
}
else
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 798d89b..445e414 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-03-06 Marek Polacek <polacek@redhat.com>
+
+ PR c++/79796 - ICE with NSDMI and this pointer
+ * g++.dg/cpp0x/nsdmi13.C: New test.
+
2017-03-06 Julia Koval <julia.koval@intel.com>
PR target/79793
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi13.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi13.C
new file mode 100644
index 0000000..2751da3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi13.C
@@ -0,0 +1,13 @@
+// PR c++/79796
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ A* p = this;
+};
+
+void foo()
+{
+ A a;
+ a = A({});
+}