diff options
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/init.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/array14.C | 10 |
4 files changed, 22 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 56c3a2c..4627b8b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 50b0bca..2b8d768 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1830984..24cdbb2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/g++.dg/template/array14.C b/gcc/testsuite/g++.dg/template/array14.C new file mode 100644 index 0000000..71a03f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/array14.C @@ -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]; +} |