aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-04-04 12:42:33 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-04-04 12:42:33 -0400
commit239209c4c45b16724b704e68ef8b949d806d3121 (patch)
treebf3c57e62d431722c3f881808b78379de7bb6279
parent1229c56cb93056caccf7af284cc15fe5e4f435f3 (diff)
downloadgcc-239209c4c45b16724b704e68ef8b949d806d3121.zip
gcc-239209c4c45b16724b704e68ef8b949d806d3121.tar.gz
gcc-239209c4c45b16724b704e68ef8b949d806d3121.tar.bz2
PR c++/85148 - ICE with 'this' in array NSDMI.
* tree.c (replace_placeholders_r): Use handled_component_p. From-SVN: r259088
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/tree.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr11.C12
3 files changed, 18 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0c71d2b..61483a5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2018-04-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/85148 - ICE with 'this' in array NSDMI.
+ * tree.c (replace_placeholders_r): Use handled_component_p.
+
2018-04-04 Ville Voutilainen <ville.voutilainen@gmail.com>
PR c++/65923
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index e75c88d..7ddc2cb 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -3145,7 +3145,7 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_)
for (; !same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (*t),
TREE_TYPE (x));
x = TREE_OPERAND (x, 0))
- gcc_assert (TREE_CODE (x) == COMPONENT_REF);
+ gcc_assert (handled_component_p (x));
*t = unshare_expr (x);
*walk_subtrees = false;
d->seen = true;
diff --git a/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr11.C b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr11.C
new file mode 100644
index 0000000..09591df
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr11.C
@@ -0,0 +1,12 @@
+// PR c++/85148
+// { dg-do compile { target c++14 } }
+
+template<typename T> struct A
+{
+ T x[1]{(__PTRDIFF_TYPE__)this};
+};
+
+void foo()
+{
+ A<A<__PTRDIFF_TYPE__>> a{};
+}