Gcc v2.6.3 currently has a problem with templates. Specifically, with

default switches, template functions get EXTERNAL linkage in each file
in which they occur, causing multiple definition errors during
linking.  The enclosed patch (from gnu.g++.bug) appears to solve the
problem (I enclose the accompanying message as well).

This patch fixes the multiply defined template functions bug
which was introduced in 2.6.1.

Submitted by:	"Justin T. Gibbs" <gibbs@estienne.cs.berkeley.edu>
Obtained from:  Jason Merrill at cygnus support on G++ mailing list
This commit is contained in:
nate 1995-03-17 21:24:25 +00:00
parent 679d92a8d1
commit 1f5ee0855a

View File

@ -2302,6 +2302,10 @@ do_pending_expansions ()
else if (! flag_implicit_templates)
DECIDE (0);
if (i->interface == 1)
/* OK, it was an implicit instantiation. */
TREE_PUBLIC (t) = 0;
/* If it's a method, let the class type decide it.
@@ What if the method template is in a separate file?
Maybe both file contexts should be taken into account?