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: r155292
This commit is contained in:
Jason Merrill 2009-12-16 12:36:05 -05:00 committed by Jason Merrill
parent 6568e44adf
commit 483a1dce8a
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 Jason Merrill <jason@redhat.com> 2009-12-15 Jason Merrill <jason@redhat.com>
PR c++/42358 PR c++/42358

View File

@ -7270,11 +7270,8 @@ compute_array_index_type (tree name, tree size)
structural equality checks. */ structural equality checks. */
itype = build_index_type (build_min (MINUS_EXPR, sizetype, itype = build_index_type (build_min (MINUS_EXPR, sizetype,
size, integer_one_node)); 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); SET_TYPE_STRUCTURAL_EQUALITY (itype);
return 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-16 Jakub Jelinek <jakub@redhat.com> 2009-12-16 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/compile/20091215-1.c: New test. * gcc.c-torture/compile/20091215-1.c: New test.

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;