aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@gcc.gnu.org>2016-03-24 15:59:53 +0000
committerPatrick Palka <ppalka@gcc.gnu.org>2016-03-24 15:59:53 +0000
commit887ab4e55402409cd7b56ad518607d05687b7ed2 (patch)
treee4e7977b4192f70da34b123ba7285848271f4783 /gcc
parentfc3fb4bad52a2185acb11a3c17aead7d63719954 (diff)
downloadgcc-887ab4e55402409cd7b56ad518607d05687b7ed2.zip
gcc-887ab4e55402409cd7b56ad518607d05687b7ed2.tar.gz
gcc-887ab4e55402409cd7b56ad518607d05687b7ed2.tar.bz2
Fix PR c++/62212 (ICE during mangling of array type)
gcc/cp/ChangeLog: PR c++/62212 * tree.c (build_cplus_array_type): Determine type-dependentess with uses_template_parms instead of with dependent_type_p. gcc/testsuite/ChangeLog: PR c++/62212 * g++.dg/template/mangle2.C: New test. From-SVN: r234457
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/tree.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/mangle2.C19
4 files changed, 32 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b32c72d..dbef1b2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-24 Patrick Palka <ppalka@gcc.gnu.org>
+
+ PR c++/62212
+ * tree.c (build_cplus_array_type): Determine type-dependentess
+ with uses_template_parms instead of with dependent_type_p.
+
2016-03-23 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/70347
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index f784952..5d9de34 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -824,9 +824,8 @@ build_cplus_array_type (tree elt_type, tree index_type)
if (elt_type == error_mark_node || index_type == error_mark_node)
return error_mark_node;
- bool dependent = (processing_template_decl
- && (dependent_type_p (elt_type)
- || (index_type && dependent_type_p (index_type))));
+ bool dependent = (uses_template_parms (elt_type)
+ || (index_type && uses_template_parms (index_type)));
if (elt_type != TYPE_MAIN_VARIANT (elt_type))
/* Start with an array of the TYPE_MAIN_VARIANT. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 99ef9f7..582bb8b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-24 Patrick Palka <ppalka@gcc.gnu.org>
+
+ PR c++/62212
+ * g++.dg/template/mangle2.C: New test.
+
2016-03-24 Richard Biener <rguenther@suse.de>
PR tree-optimization/70396
diff --git a/gcc/testsuite/g++.dg/template/mangle2.C b/gcc/testsuite/g++.dg/template/mangle2.C
new file mode 100644
index 0000000..50b0d9f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/mangle2.C
@@ -0,0 +1,19 @@
+// PR c++/62212
+// { dg-do assemble }
+
+typedef int my_int;
+
+template<typename T>
+struct X {
+ enum {value = 1};
+};
+
+template<typename T>
+void f(const my_int(&)[X<T>::value]);
+
+int main() {
+ const my_int a[1] = {};
+ f<void>(a);
+}
+
+// { dg-final { scan-assembler "_Z1fIvEvRAsr1XIT_E5value_Ki" } }