PR c++/58281 - explicit instantiation of constexpr
authorJason Merrill <jason@redhat.com>
Fri, 1 Jun 2018 20:49:33 +0000 (16:49 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 1 Jun 2018 20:49:33 +0000 (16:49 -0400)
* pt.c (mark_decl_instantiated): Clear DECL_EXTERNAL.

From-SVN: r261085

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

index 220b80b4098a7a938a33d6cbab5c58f10b015cd6..ec827c251089ca7959e32695b43f6adf8b33d9b1 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-01  Jason Merrill  <jason@redhat.com>
+
+       PR c++/58281 - explicit instantiation of constexpr
+       * pt.c (mark_decl_instantiated): Clear DECL_EXTERNAL.
+
 2018-05-31  Jason Merrill  <jason@redhat.com>
 
        * pt.c (instantiate_decl): Any defaulted function is defined.
index b97cd3013be7a8848e104c5a15c57f9d1125fba6..4c5890deeb8793d93ff6b526b5564c501df0a40a 100644 (file)
@@ -22168,6 +22168,12 @@ mark_decl_instantiated (tree result, int extern_p)
         linkonce sections.  */
       else if (TREE_PUBLIC (result))
        maybe_make_one_only (result);
+      if (TREE_CODE (result) == FUNCTION_DECL
+         && DECL_TEMPLATE_INSTANTIATED (result))
+       /* If the function has already been instantiated, clear DECL_EXTERNAL,
+          since start_preparsed_function wouldn't have if we had an earlier
+          extern explicit instantiation.  */
+       DECL_EXTERNAL (result) = 0;
     }
 
   /* If EXTERN_P, then this function will not be emitted -- unless