re PR c++/13289 (ICE in regenerate_decl_from_template on recursive template)

2004-01-12  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

        PR c++/13289
        * pt.c (instantiate_decl): Set DECL_TEMPLATE_INSTANTIATED before
        calling regenerate_decl_from_template.
2004-01-12  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

        PR c++/13289
        * g++.dg/template/instantiate6.C: New test.

From-SVN: r75752
This commit is contained in:
Kriang Lerdsuwanakij 2004-01-12 20:10:19 +00:00 committed by Andrew Pinski
parent ff2aaa93cc
commit 66e0c44047
4 changed files with 36 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2004-01-12 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/13289
* pt.c (instantiate_decl): Set DECL_TEMPLATE_INSTANTIATED before
calling regenerate_decl_from_template.
2004-01-12 Scott Brumbaugh <scottb.lists@verizon.net>
PR c++/4100

View File

@ -11016,6 +11016,10 @@ instantiate_decl (tree d, int defer_ok)
if (need_push)
push_to_top_level ();
/* Mark D as instantiated so that recursive calls to
instantiate_decl do not try to instantiate it again. */
DECL_TEMPLATE_INSTANTIATED (d) = 1;
/* Regenerate the declaration in case the template has been modified
by a subsequent redeclaration. */
regenerate_decl_from_template (d, td);
@ -11052,13 +11056,14 @@ instantiate_decl (tree d, int defer_ok)
instantiation. There, we cannot implicitly instantiate a
defined static data member in more than one translation
unit, so import_export_decl marks the declaration as
external; we must rely on explicit instantiation. */
external; we must rely on explicit instantiation.
Reset instantiated marker to make sure that later
explicit instantiation will be processed. */
DECL_TEMPLATE_INSTANTIATED (d) = 0;
}
else
{
/* Mark D as instantiated so that recursive calls to
instantiate_decl do not try to instantiate it again. */
DECL_TEMPLATE_INSTANTIATED (d) = 1;
/* This is done in analogous to `start_decl'. It is
required for correct access checking. */
push_nested_class (DECL_CONTEXT (d));

View File

@ -1,3 +1,8 @@
2004-01-12 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/13289
* g++.dg/template/instantiate6.C: New test.
2004-01-12 Roger Sayle <roger@eyesopen.com>
PR middle-end/11397

View File

@ -0,0 +1,16 @@
// { dg-do compile }
// Origin: gianni@mariani.ws
// Wolfgang Bangerth <bangerth@ticam.utexas.edu>
// PR c++/13289: ICE recursively instantiate static member data.
template <int N> struct S {
static const int C;
};
template <int N>
const int S<N>::C = S<(N+1)%2>::C;
template struct S<1>;