Commit f513e31f by Mark Mitchell Committed by Mark Mitchell

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
parent b1eb8119
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> 2005-09-21 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/23965 PR c++/23965
......
...@@ -1567,12 +1567,8 @@ build_offset_ref (tree type, tree name, bool address_p) ...@@ -1567,12 +1567,8 @@ build_offset_ref (tree type, tree name, bool address_p)
tree tree
integral_constant_value (tree decl) integral_constant_value (tree decl)
{ {
while ((TREE_CODE (decl) == CONST_DECL while (TREE_CODE (decl) == CONST_DECL
|| (TREE_CODE (decl) == VAR_DECL || DECL_INTEGRAL_CONSTANT_VAR_P (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))))
{ {
tree init; tree init;
/* If DECL is a static data member in a template class, we must /* If DECL is a static data member in a template class, we must
......
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> 2005-09-21 Erik Edelmann <erik.edelmann@iki.fi>
PR fortran/19929 PR fortran/19929
// PR c++/23993
const int data[2][4] = {
{ 0, 1, 2, 3 }
};
template <typename T>
void t(int k) {
int candidate = data[1][k];
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment