Commit 6da06848 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/28879 (ICE with VLA in template function)

	PR c++/28879
	* tree.c (build_cplus_array_type_1): Don't pass any VLA types
	when processing_template_decl to build_array_type.

	* g++.dg/template/vla2.C: New test.

From-SVN: r130309
parent 63d34078
2007-11-20 Jakub Jelinek <jakub@redhat.com> 2007-11-20 Jakub Jelinek <jakub@redhat.com>
PR c++/28879
* tree.c (build_cplus_array_type_1): Don't pass any VLA types
when processing_template_decl to build_array_type.
PR c++/33962 PR c++/33962
* pt.c (more_specialized_fn): Don't segfault if one or * pt.c (more_specialized_fn): Don't segfault if one or
both argument list end with ellipsis. both argument list end with ellipsis.
......
...@@ -529,9 +529,9 @@ build_cplus_array_type_1 (tree elt_type, tree index_type) ...@@ -529,9 +529,9 @@ build_cplus_array_type_1 (tree elt_type, tree index_type)
if (elt_type == error_mark_node || index_type == error_mark_node) if (elt_type == error_mark_node || index_type == error_mark_node)
return error_mark_node; return error_mark_node;
if (dependent_type_p (elt_type) if (processing_template_decl
|| (index_type && (dependent_type_p (elt_type)
&& value_dependent_expression_p (TYPE_MAX_VALUE (index_type)))) || (index_type && !TREE_CONSTANT (TYPE_MAX_VALUE (index_type)))))
{ {
void **e; void **e;
cplus_array_info cai; cplus_array_info cai;
...@@ -570,7 +570,7 @@ build_cplus_array_type_1 (tree elt_type, tree index_type) ...@@ -570,7 +570,7 @@ build_cplus_array_type_1 (tree elt_type, tree index_type)
TYPE_CANONICAL (t) TYPE_CANONICAL (t)
= build_cplus_array_type = build_cplus_array_type
(TYPE_CANONICAL (elt_type), (TYPE_CANONICAL (elt_type),
index_type? TYPE_CANONICAL (index_type) : index_type); index_type ? TYPE_CANONICAL (index_type) : index_type);
else else
TYPE_CANONICAL (t) = t; TYPE_CANONICAL (t) = t;
} }
......
2007-11-20 Jakub Jelinek <jakub@redhat.com> 2007-11-20 Jakub Jelinek <jakub@redhat.com>
PR c++/28879
* g++.dg/template/vla2.C: New test.
PR c++/33962 PR c++/33962
* g++.dg/overload/template3.C: New test. * g++.dg/overload/template3.C: New test.
// PR c++/28879
// { dg-do compile }
// { dg-options "" }
struct A
{
static int i;
int j;
};
template<int> void foo ()
{
int x[A::i];
//int y[A().j];
}
void bar ()
{
foo<6> ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment