re PR c++/42387 (ICE with new expression in class template)

PR c++/42387
	* decl.c (compute_array_index_type): Mark a VLA as dependent.

From-SVN: r155293
This commit is contained in:
Jason Merrill 2009-12-16 13:02:38 -05:00 committed by Jason Merrill
parent 2184887895
commit 9d8bad45a2
4 changed files with 27 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2009-12-16 Jason Merrill <jason@redhat.com>
PR c++/42387
* decl.c (compute_array_index_type): Mark a VLA as dependent.
2009-12-15 Jakub Jelinek <jakub@redhat.com>
PR c++/41183

View File

@ -7218,11 +7218,8 @@ compute_array_index_type (tree name, tree size)
structural equality checks. */
itype = build_index_type (build_min (MINUS_EXPR, sizetype,
size, integer_one_node));
if (!TREE_SIDE_EFFECTS (size))
{
TYPE_DEPENDENT_P (itype) = 1;
TYPE_DEPENDENT_P_VALID (itype) = 1;
}
TYPE_DEPENDENT_P (itype) = 1;
TYPE_DEPENDENT_P_VALID (itype) = 1;
SET_TYPE_STRUCTURAL_EQUALITY (itype);
return itype;
}

View File

@ -1,3 +1,8 @@
2009-12-15 Jason Merrill <jason@redhat.com>
PR c++/42387
* g++.dg/ext/vla8.C: New.
2009-12-15 Jakub Jelinek <jakub@redhat.com>
PR c++/41183

View File

@ -0,0 +1,15 @@
// PR c++/42387
// { dg-options "" }
template<class PF>
struct AvlTreeIter
{
int Num();
AvlTreeIter()
{
new (void* [Num()]);
}
};
AvlTreeIter<int> a;