From: Jason Merrill Date: Tue, 10 Jun 2003 19:08:46 +0000 (-0400) Subject: re PR c++/10968 (If member function implicitly instantiated, explicit instantiation... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=346eeb157eed29835cbe240fcd0f68c58f3decce;p=gcc.git re PR c++/10968 (If member function implicitly instantiated, explicit instantiation of class fails to instantiate it) PR c++/10968 * pt.c (mark_decl_instantiated): Set TREE_SYMBOL_REFERENCED. [[Split portion of a mixed commit.]] From-SVN: r67725.2 --- diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1f64f747ca6..926b26d5c55 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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 index 00000000000..21109a765aa --- /dev/null +++ b/gcc/testsuite/g++.dg/template/explicit-instantiation2.C @@ -0,0 +1,6 @@ +// Bug 10968: implicit instantiation overrides explicit instantiation +// { dg-final { scan-assembler "_Z1fIiET_S0_" } } + +template T f (T t) { return t; } +inline void g () { f (4); } +template int f (int);