* pt.c (instantiate_decl): Defer all templates but inline functions.
authorJason Merrill <jason@yorick.cygnus.com>
Thu, 11 Dec 1997 05:15:37 +0000 (05:15 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 11 Dec 1997 05:15:37 +0000 (00:15 -0500)
From-SVN: r17039

gcc/cp/ChangeLog
gcc/cp/pt.c

index 0ddfaf5f559391df7eb88e789cd7383a0ca2150c..88732201b200e273ceeddb122ed1670ddd003a06 100644 (file)
@@ -1,3 +1,7 @@
+Wed Dec 10 11:04:45 1997  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * pt.c (instantiate_decl): Defer all templates but inline functions.
+
 Mon Dec  8 23:17:13 1997  Jason Merrill  <jason@yorick.cygnus.com>
 
        * init.c (expand_vec_init): Don't fold a list of parameters.
index c35dc2089633730c1bdfdeb1c42da6e35b7ea0fb..a68bf1fb6be36d3a7653de2f5e1787f096dd0543 100644 (file)
@@ -4553,15 +4553,16 @@ instantiate_decl (d)
        import_export_decl (d);
     }
 
+  /* Reject all external templates except inline functions.  */
+  if (DECL_INTERFACE_KNOWN (d)
+      && ! DECL_NOT_REALLY_EXTERN (d)
+      && ! (TREE_CODE (d) == FUNCTION_DECL && DECL_INLINE (d)))
+    goto out;
+
+  /* Defer all templates except inline functions used in another function.  */
   if (! pattern_defined
-      || (TREE_CODE (d) == FUNCTION_DECL && ! DECL_INLINE (d)
-         && (! DECL_INTERFACE_KNOWN (d)
-             || ! DECL_NOT_REALLY_EXTERN (d)))
-      /* Kludge: if we compile a constructor in the middle of processing a
-         toplevel declaration, we blow away the declspecs in
-         temp_decl_obstack when we call permanent_allocation in
-         finish_function.  So don't compile it yet.  */
-      || (TREE_CODE (d) == FUNCTION_DECL && ! nested && ! at_eof))
+      || (! (TREE_CODE (d) == FUNCTION_DECL && DECL_INLINE (d) && nested)
+         && ! at_eof))
     {
       add_pending_template (d);
       goto out;