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
This commit is contained in:
Marek Polacek 2015-03-31 17:35:29 +00:00 committed by Marek Polacek
parent 9e91e2cd71
commit 397ad54db1
4 changed files with 26 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2015-03-31 Marek Polacek <polacek@redhat.com>
PR c++/65390
* tree.c (build_cplus_array_type): Use dependent_type_p rather than
checking for constness.
2015-03-30 Marek Polacek <polacek@redhat.com>
PR c++/65398

View File

@ -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. */

View File

@ -1,3 +1,8 @@
2015-03-31 Marek Polacek <polacek@redhat.com>
PR c++/65390
* g++.dg/template/pr65390.C: New test.
2015-03-31 Martin Liska <mliska@suse.cz>
* g++.dg/ipa/pr65557.C: New test.

View File

@ -0,0 +1,12 @@
// PR c++/65390
// { dg-do compile }
// { dg-options "" }
template<typename T> struct shared_ptr { };
template<typename T, typename Arg>
shared_ptr<T> make_shared(Arg) { return shared_ptr<T>(); } // { dg-error "variably modified type|trying to instantiate" }
void f(int n){
make_shared<int[n]>(1); // { dg-error "no matching function" }
}