re PR c++/11131 (Unrelated declaration removes inline flag from function)
authorMark Mitchell <mark@codesourcery.com>
Wed, 11 Jun 2003 17:02:13 +0000 (17:02 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 11 Jun 2003 17:02:13 +0000 (17:02 +0000)
PR c++/11131
* tree.c (cp_cannot_inline_fn): Check for "inline" before
instantiation.

From-SVN: r67783

gcc/cp/ChangeLog
gcc/cp/tree.c

index a6e4e03486995e99ba5431a37e0fe69194428b8d..0f79c7cc41f3e5ddc6b89f4446eebed4afaf5b79 100644 (file)
@@ -1,3 +1,9 @@
+2003-06-11  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/11131
+       * tree.c (cp_cannot_inline_fn): Check for "inline" before
+       instantiation.
+
 2003-06-10  Jason Merrill  <jason@redhat.com>
 
        PR c++/10968
index b696c3bd655c6671016d71fc2dcb747015e34c24..2e907c0b837f61f53118b7aff6217cf6f65bcb07 100644 (file)
@@ -2209,14 +2209,16 @@ cp_cannot_inline_tree_fn (fnp)
   if (DECL_TEMPLATE_INFO (fn)
       && TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
     {
+      /* Don't instantiate functions that are not going to be
+        inlined.  */
+      if (!DECL_INLINE (DECL_TEMPLATE_RESULT 
+                       (template_for_substitution (fn))))
+       return 1;
       fn = *fnp = instantiate_decl (fn, /*defer_ok=*/0);
       if (TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
        return 1;
     }
 
-  if (!DECL_INLINE (fn))
-    return 1;
-
   if (flag_really_no_inline
       && lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) == NULL)
     return 1;