OSDN Git Service

PR c++/10968
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Jun 2003 19:08:46 +0000 (19:08 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Jun 2003 19:08:46 +0000 (19:08 +0000)
        * pt.c (mark_decl_instantiated): Set TREE_SYMBOL_REFERENCED.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67725 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/pt.c
gcc/testsuite/g++.dg/template/explicit-instantiation2.C [new file with mode: 0644]

index 1f64f74..926b26d 100644 (file)
@@ -9974,6 +9974,9 @@ mark_decl_instantiated (result, extern_p)
        set correctly by tsubst.  */
     TREE_PUBLIC (result) = 1;
 
+  /* This might have been set by an earlier implicit instantiation.  */
+  DECL_COMDAT (result) = 0;
+
   if (! extern_p)
     {
       DECL_INTERFACE_KNOWN (result) = 1;
diff --git a/gcc/testsuite/g++.dg/template/explicit-instantiation2.C b/gcc/testsuite/g++.dg/template/explicit-instantiation2.C
new file mode 100644 (file)
index 0000000..21109a7
--- /dev/null
@@ -0,0 +1,6 @@
+// Bug 10968: implicit instantiation overrides explicit instantiation
+// { dg-final { scan-assembler "_Z1fIiET_S0_" } }
+
+template <class T> T f (T t) { return t; }
+inline void g () { f (4); }
+template int f (int);