(C++) 'extern template' patch

Jason Merrill jason@cygnus.com
Mon Jun 5 16:52:00 GMT 2000


Mark's long ago patch to tighten up checking of explicit
instantiations broke 'extern template' for member functions, as I only
recently noticed.  Fixes g++.ext/instantiate1.C.

2000-06-05  Jason Merrill  <jason@casey.soma.redhat.com>

	* pt.c (mark_decl_instantiated): Do SET_DECL_EXPLICIT_INSTANTIATION
	here if extern_p.

Index: pt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/pt.c,v
retrieving revision 1.433
diff -c -p -r1.433 pt.c
*** pt.c	2000/06/05 01:42:22	1.433
--- pt.c	2000/06/05 23:46:59
*************** mark_decl_instantiated (result, extern_p
*** 8761,8766 ****
--- 8794,8807 ----
         set correctly by tsubst.  */
      TREE_PUBLIC (result) = 1;
  
+   /* We used to set this unconditionally; we moved that to
+      do_decl_instantiation so it wouldn't get set on members of
+      explicit class template instantiations.  But we still need to set
+      it here for the 'extern template' case in order to suppress
+      implicit instantiations.  */
+   if (extern_p)
+     SET_DECL_EXPLICIT_INSTANTIATION (result);
+ 
    if (! extern_p)
      {
        DECL_INTERFACE_KNOWN (result) = 1;


More information about the Gcc-patches mailing list