From 1f5ee0855afbfc7e47ca5e23e70071c73692e2a4 Mon Sep 17 00:00:00 2001 From: nate Date: Fri, 17 Mar 1995 21:24:25 +0000 Subject: [PATCH] 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" Obtained from: Jason Merrill at cygnus support on G++ mailing list --- gnu/usr.bin/cc/cc1plus/pt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gnu/usr.bin/cc/cc1plus/pt.c b/gnu/usr.bin/cc/cc1plus/pt.c index c3ff8d8e0ceb..cb6b0e46f482 100644 --- a/gnu/usr.bin/cc/cc1plus/pt.c +++ b/gnu/usr.bin/cc/cc1plus/pt.c @@ -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?