re PR c++/13494 (ICE on bidimensional array subscription in template function.)

cp:
	PR c++/13494
	* tree.c (build_cplus_array_type_1): Only build a minimal array
	type for dependent types or domains.
testsuite:
	PR c++/13494
	* g++.dg/template/array2-1.C: New test.
	* g++.dg/template/array2-2.C: New test.

From-SVN: r75225
This commit is contained in:
Nathan Sidwell 2003-12-30 10:07:13 +00:00 committed by Nathan Sidwell
parent a043b1f5c9
commit 58496de135
5 changed files with 43 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2003-12-30 Nathan Sidwell <nathan@codesourcery.com>
PR c++/13494
* tree.c (build_cplus_array_type_1): Only build a minimal array
type for dependent types or domains.
2003-12-29 Nathan Sidwell <nathan@codesourcery.com>
PR c++/12774

View File

@ -363,14 +363,9 @@ build_cplus_array_type_1 (tree elt_type, tree index_type)
if (elt_type == error_mark_node || index_type == error_mark_node)
return error_mark_node;
/* Don't do the minimal thing just because processing_template_decl is
set; we want to give string constants the right type immediately, so
we don't have to fix them up at instantiation time. */
if ((processing_template_decl
&& index_type && TYPE_MAX_VALUE (index_type)
&& TREE_CODE (TYPE_MAX_VALUE (index_type)) != INTEGER_CST)
|| uses_template_parms (elt_type)
|| (index_type && uses_template_parms (index_type)))
if (dependent_type_p (elt_type)
|| (index_type
&& value_dependent_expression_p (TYPE_MAX_VALUE (index_type))))
{
t = make_node (ARRAY_TYPE);
TREE_TYPE (t) = elt_type;

View File

@ -1,3 +1,9 @@
2003-12-30 Nathan Sidwell <nathan@codesourcery.com>
PR c++/13494
* g++.dg/template/array2-1.C: New test.
* g++.dg/template/array2-2.C: New test.
2003-12-29 Mark Mitchell <mark@codesourcery.com>
* g++.old-deja/g++.pt/static11.C: Correct XFAIL syntax.

View File

@ -0,0 +1,14 @@
// { dg-do compile }
// { dg-options "-fabi-version=1" }
// Copyright (C) 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Dec 2003 <nathan@codesourcery.com>
// PR c++/13494. ICE
template<typename T>
int foo(int d[][4])
{
return d[0][0];
}

View File

@ -0,0 +1,14 @@
// { dg-do compile }
// { dg-options "-fabi-version=2" }
// Copyright (C) 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Dec 2003 <nathan@codesourcery.com>
// PR c++/13494. ICE
template<typename T>
int foo(int d[][4])
{
return d[0][0];
}