From 397ad54db15fb4c8c6efdabefa76fa5865ff6c0c Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 31 Mar 2015 17:35:29 +0000 Subject: [PATCH] re PR c++/65390 (ICE in strip_typedefs, at cp/tree.c:1361) PR c++/65390 * tree.c (build_cplus_array_type): Use dependent_type_p rather than checking for constness. * g++.dg/template/pr65390.C: New test. From-SVN: r221799 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/tree.c | 7 +++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/pr65390.C | 12 ++++++++++++ 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/pr65390.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ec35f22fe04..0d2456d6eb8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-03-31 Marek Polacek + + PR c++/65390 + * tree.c (build_cplus_array_type): Use dependent_type_p rather than + checking for constness. + 2015-03-30 Marek Polacek PR c++/65398 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index ef53aff87f7..97bccc03403 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -822,10 +822,9 @@ 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 && !TREE_CONSTANT (TYPE_MAX_VALUE (index_type))))); + bool dependent = (processing_template_decl + && (dependent_type_p (elt_type) + || (index_type && dependent_type_p (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 5d0d3b4f73f..e317b5e0011 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-03-31 Marek Polacek + + PR c++/65390 + * g++.dg/template/pr65390.C: New test. + 2015-03-31 Martin Liska * g++.dg/ipa/pr65557.C: New test. diff --git a/gcc/testsuite/g++.dg/template/pr65390.C b/gcc/testsuite/g++.dg/template/pr65390.C new file mode 100644 index 00000000000..299d22a7ee3 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr65390.C @@ -0,0 +1,12 @@ +// PR c++/65390 +// { dg-do compile } +// { dg-options "" } + +template struct shared_ptr { }; + +template +shared_ptr make_shared(Arg) { return shared_ptr(); } // { dg-error "variably modified type|trying to instantiate" } + +void f(int n){ + make_shared(1); // { dg-error "no matching function" } +} -- 2.30.2