I'm soliciting feedback regrading a problem in the 4.0.2 release. PR 23993 is a rejects-valid C++ PR that represents a regression from GCC 4.0.1. That's particularly unfortunate; we really want to avoid introducing new breakage on the release branch.
It is, sadly, more fallout from my static data member patch; it has uncovered a latent bug in integral_constant_value. Here is the test case from the PR: const int data[2][4] = { { 0, 1, 2, 3 } }; template <typename T> void t(int k) { int candidate = data[1][k]; } The key is that an const array (or, perhaps, structure) of integral type is accessed in a template. I have a patch for the PR, which I am testing now; the patch is attached, and is relatively simple. So, my options are: 1. Release 4.0.2 without fixing this PR. (The bits are ready, sitting on my disk.) 2. Apply the patch, respin the release, and release it. 3. Apply the patch, spin RC3, and go through another testing cycle. My current plan is (2) because I think that this is an important bug and because I think the patch is safe and, in particular, highly unlikely to introduce any follow-on problems of its own. However, I realize that I can't be entirely objective about this situation, so I'd appreciate any feedback. -- Mark Mitchell CodeSourcery, LLC [EMAIL PROTECTED] Index: init.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cp/init.c,v retrieving revision 1.429 diff -c -5 -p -r1.429 init.c *** init.c 6 Sep 2005 14:55:03 -0000 1.429 --- init.c 21 Sep 2005 13:26:27 -0000 *************** build_offset_ref (tree type, tree name, *** 1565,1580 **** [5.19/1]. FIXME:If we did lazy folding, this could be localized. */ 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)))) { tree init; /* If DECL is a static data member in a template class, we must instantiate it here. The initializer for the static data member is not processed until needed; we need it now. */ --- 1565,1576 ---- [5.19/1]. FIXME:If we did lazy folding, this could be localized. */ tree integral_constant_value (tree 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 instantiate it here. The initializer for the static data member is not processed until needed; we need it now. */