This is the mail archive of the
mailing list for the GCC project.
Re: [C++ PATCH] [PR14448] Fold non-dependent initializers in templates(regression)
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Giovanni Bajo <giovannibajo at libero dot it>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 09 Mar 2004 02:27:31 -0800
- Subject: Re: [C++ PATCH] [PR14448] Fold non-dependent initializers in templates(regression)
- Organization: CodeSourcery, LLC
- References: <020901c404b5$c55cc700$424d2597@bagio>
Giovanni Bajo wrote:
PR c++/14448 exposed two different bugs.
- The testcase was segfaulting deep into pt.c because of another
tsubst_copy_and_build -> tsubst_copy fallback. For the logs, the problem is
that fold_non_dependent_expr (called for the template argument "n+1") does not
setup local_specializations, so tsubst_decl cannot work correctly (and I'm not
sure if there is something wrong in this or not). Anyway, it's my understanding
that tsubst_copy is obsolete now and should be removed, so adding support for
the missing tree in tsubst_copy_and_build is enough to fix the crash.
- After that, we get a meaningful error message, which says that "((int)n)+1 is
non-constant". It appears that the problem is that the initializer of the
static const variable\ was never folded correctly because it is within a
template. I added a call to fold_non_dependent_expr at the right spot of the
Tested on i686-pc-linux-gnu with no new regressions. OK for mainline and 3.4?