re PR c++/23993 (Mysterious compiler error when accessing a 2d-array in a template class)

PR c++/23993
	* init.c (integral_constant_value): Use DECL_INTEGRAL_CONSTANT_VAR_P.

	PR c++/23993
	* g++.dg/template/array14.C: New test.

From-SVN: r104511
This commit is contained in:
Mark Mitchell 2005-09-22 00:11:22 +00:00 committed by Mark Mitchell
parent b1eb8119ac
commit f513e31f31
4 changed files with 22 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2005-09-21 Mark Mitchell <mark@codesourcery.com>
PR c++/23993
* init.c (integral_constant_value): Use DECL_INTEGRAL_CONSTANT_VAR_P.
2005-09-21 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/23965

View File

@ -1567,12 +1567,8 @@ build_offset_ref (tree type, tree name, bool address_p)
tree
integral_constant_value (tree decl)
{
while ((TREE_CODE (decl) == CONST_DECL
|| (TREE_CODE (decl) == VAR_DECL
/* And so are variables with a 'const' type -- unless they
are also 'volatile'. */
&& CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (decl))
&& DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl))))
while (TREE_CODE (decl) == CONST_DECL
|| DECL_INTEGRAL_CONSTANT_VAR_P (decl))
{
tree init;
/* If DECL is a static data member in a template class, we must

View File

@ -1,3 +1,8 @@
2005-09-21 Mark Mitchell <mark@codesourcery.com>
PR c++/23993
* g++.dg/template/array14.C: New test.
2005-09-21 Erik Edelmann <erik.edelmann@iki.fi>
PR fortran/19929

View File

@ -0,0 +1,10 @@
// PR c++/23993
const int data[2][4] = {
{ 0, 1, 2, 3 }
};
template <typename T>
void t(int k) {
int candidate = data[1][k];
}