]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/13289 (ICE in regenerate_decl_from_template on recursive template)
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Wed, 21 Jan 2004 03:26:06 +0000 (03:26 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Wed, 21 Jan 2004 03:26:06 +0000 (03:26 +0000)
2004-01-20  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

    PR c++/13289
    * pt.c (instantiate_decl): Set DECL_TEMPLATE_INSTANTIATED before
    calling regenerate_decl_from_template.

From-SVN: r76255

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/template/instantiate6.C

index 2b88ca0304f8e84dbd5737691980cf87ff69f334..04fe29e32f72d430e6d6c64f8be5e85144acbc96 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-20  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-14  Gabriel Dos Reis <gdr@integrable-solutions.net>
 
        Backport from mainline
index 3000847879e57f0ac2ef3488a923dadc4bb399e3..e64ed166b3e34d27e537562407911f0074f42fb4 100644 (file)
@@ -10449,6 +10449,10 @@ instantiate_decl (d, 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);
@@ -10485,13 +10489,14 @@ instantiate_decl (d, 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), 2);
@@ -10512,10 +10517,6 @@ instantiate_decl (d, defer_ok)
     {
       htab_t saved_local_specializations;
 
-      /* Mark D as instantiated so that recursive calls to
-        instantiate_decl do not try to instantiate it again.  */
-      DECL_TEMPLATE_INSTANTIATED (d) = 1;
-
       /* Save away the current list, in case we are instantiating one
         template from within the body of another.  */
       saved_local_specializations = local_specializations;
index d5d712ee09122b4ab6b5e9615a00eb1e9836eca3..895e6d8e5053b10592c7f02d8ad8cba541a639db 100644 (file)
@@ -1,7 +1,7 @@
 // { dg-do compile }
 
 // Origin: gianni@mariani.ws
-//       Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+//        Wolfgang Bangerth <bangerth@ticam.utexas.edu>
 
 // PR c++/13289: ICE recursively instantiate static member data.
 
@@ -13,4 +13,3 @@ template <int N>
 const int S<N>::C = S<(N+1)%2>::C;
  
 template struct S<1>;
-