This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] [PR14448] Fold non-dependent initializers in templates(regression)


Giovanni Bajo wrote:

Hello,

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
parser.

Tested on i686-pc-linux-gnu with no new regressions. OK for mainline and 3.4?


Yes, thanks.

--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]