Commit 66e0c440 by Kriang Lerdsuwanakij Committed by Andrew Pinski

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
parent ff2aaa93
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
......
......@@ -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));
......
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
......
// { 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>;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment