re PR c++/10347 (tree check ICE in dependent_type_p)

PR c++/10347
	* pt.c (type_dependent_expression_p): Handle array new.

	g++.dg/template/dependent-name1.C: New test.

From-SVN: r65742
This commit is contained in:
Kriang Lerdsuwanakij 2003-04-17 14:05:54 +00:00 committed by Kriang Lerdsuwanakij
parent 8633f25cf5
commit 09d2f85f41
4 changed files with 35 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2003-04-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/10347
* pt.c (type_dependent_expression_p): Handle array new.
2003-04-15 Mark Mitchell <mark@codesourcery.com>
PR c++/10381

View File

@ -11562,7 +11562,20 @@ type_dependent_expression_p (expression)
by the expression. */
else if (TREE_CODE (expression) == NEW_EXPR
|| TREE_CODE (expression) == VEC_NEW_EXPR)
return dependent_type_p (TREE_OPERAND (expression, 1));
{
/* For NEW_EXPR tree nodes created inside a template, either
the object type itself or a TREE_LIST may appear as the
operand 1. */
tree type = TREE_OPERAND (expression, 1);
if (TREE_CODE (type) == TREE_LIST)
/* This is an array type. We need to check array dimensions
as well. */
return dependent_type_p (TREE_VALUE (TREE_PURPOSE (type)))
|| value_dependent_expression_p
(TREE_OPERAND (TREE_VALUE (type), 1));
else
return dependent_type_p (type);
}
if (TREE_CODE (expression) == FUNCTION_DECL
&& DECL_LANG_SPECIFIC (expression)

View File

@ -1,3 +1,8 @@
2003-04-17 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/10347
g++.dg/template/dependent-name1.C: New test.
2003-04-17 J"orn Rennecke <joern.rennecke@superh.com>
* gcc.dg/warn-1.c (tourist_guide): New array,

View File

@ -0,0 +1,11 @@
// { dg-do compile }
// Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
// PR c++/10347: Dependent type checking of array new expression
void bar (int *);
template <int> void foo() {
bar(new int[1]);
}