aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>2003-06-10 15:08:46 -0400
committerJason Merrill <jason@gcc.gnu.org>2003-06-10 15:08:46 -0400
commit346eeb157eed29835cbe240fcd0f68c58f3decce (patch)
tree306a52da0be421e4dbaa69c117308f122425abab
parentaa9b0aca6a695876dc07e1d7d6e2de0c51776121 (diff)
downloadgcc-346eeb157eed29835cbe240fcd0f68c58f3decce.zip
gcc-346eeb157eed29835cbe240fcd0f68c58f3decce.tar.gz
gcc-346eeb157eed29835cbe240fcd0f68c58f3decce.tar.bz2
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
-rw-r--r--gcc/cp/pt.c3
-rw-r--r--gcc/testsuite/g++.dg/template/explicit-instantiation2.C6
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1f64f74..926b26d 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 0000000..21109a7
--- /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 <class T> T f (T t) { return t; }
+inline void g () { f (4); }
+template int f (int);