From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3285 invoked by alias); 29 Apr 2003 19:06:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 3234 invoked by uid 71); 29 Apr 2003 19:06:01 -0000 Resent-Date: 29 Apr 2003 19:06:01 -0000 Resent-Message-ID: <20030429190601.3233.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, snyder@fnal.gov Received: (qmail 468 invoked from network); 29 Apr 2003 19:01:18 -0000 Received: from unknown (HELO d0mino.fnal.gov) (131.225.224.45) by sources.redhat.com with SMTP; 29 Apr 2003 19:01:18 -0000 Received: from d0mino.fnal.gov (localhost [127.0.0.1]) by d0mino.fnal.gov (SGI-8.9.3p2/8.9.3) with ESMTP id OAA48740 for ; Tue, 29 Apr 2003 14:01:21 -0500 (CDT) Message-Id: <200304291901.OAA48740@d0mino.fnal.gov> Date: Tue, 29 Apr 2003 19:06:00 -0000 From: snyder@fnal.gov Reply-To: snyder@fnal.gov To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: 3.113 Subject: c++/10551: Failure to emit explicitly instantiated template w/--no-implicit-templates X-SW-Source: 2003-04/txt/msg01387.txt.bz2 List-Id: >Number: 10551 >Category: c++ >Synopsis: Failure to emit explicitly instantiated template w/--no-implicit-templates >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Tue Apr 29 19:06:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: scott snyder >Release: 3.4 20030429 (experimental) >Organization: >Environment: System: Linux karma 2.4.19-emp_2419p5a829i #1 Tue Sep 3 17:42:17 EST 2002 i686 i686 i386 GNU/Linux Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77 : (reconfigured) >Description: The source below does not link if --no-implicit-templates is used, because JTCHandleT::~JTCHandleT isn't emitted: $ g++ -o x --no-implicit-templates x.cc /tmp/ccUf5Tw9.o: In function `__static_initialization_and_destruction_0(int, int)': /tmp/ccUf5Tw9.o(.text+0x3e): undefined reference to `JTCHandleT::~JTCHandleT [in-charge]()' collect2: ld returned 1 exit status $ It does work if implicit instantiation is used. I see this both in 3.3 and 3.4; it seems to be related to this patch: 2003-04-25 Mark Mitchell * decl2.c (finish_file): Don't call import_export_decl for functions that are not defined. (handle_class_head): Robustify. If i revert this patch in 3.3, the problem goes away. >How-To-Repeat: -------------------------------------------------- template class JTCHandleT; class JTCThreadGroup; typedef JTCHandleT JTCThreadGroupHandle; template struct JTCHandleT { ~JTCHandleT(); }; template JTCHandleT::~JTCHandleT() {} struct JTCThreadGroup { struct JTCThreadGroupSet { JTCThreadGroupHandle* handles_; ~JTCThreadGroupSet() { delete [] handles_; } }; }; template class JTCHandleT; JTCHandleT x; int main () { return 0; } -------------------------------------------------- >Fix: >Release-Note: >Audit-Trail: >Unformatted: