public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: snyder@fnal.gov To: gcc-gnats@gcc.gnu.org Subject: c++/10551: Failure to emit explicitly instantiated template w/--no-implicit-templates Date: Tue, 29 Apr 2003 19:06:00 -0000 [thread overview] Message-ID: <200304291901.OAA48740@d0mino.fnal.gov> (raw) >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: <organization of PR author (multiple lines)> >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 <machine, os, target, libraries (multiple lines)> 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<JTCThreadGroup>::~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<JTCThreadGroup>::~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 <mark@codesourcery.com> * 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 T> class JTCHandleT; class JTCThreadGroup; typedef JTCHandleT<JTCThreadGroup> JTCThreadGroupHandle; template <class T> struct JTCHandleT { ~JTCHandleT(); }; template <class T> JTCHandleT<T>::~JTCHandleT() {} struct JTCThreadGroup { struct JTCThreadGroupSet { JTCThreadGroupHandle* handles_; ~JTCThreadGroupSet() { delete [] handles_; } }; }; template class JTCHandleT<JTCThreadGroup>; JTCHandleT<JTCThreadGroup> x; int main () { return 0; } -------------------------------------------------- >Fix: <how to correct or work around the problem, if known (multiple lines)> >Release-Note: >Audit-Trail: >Unformatted:
reply other threads:[~2003-04-29 19:06 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=200304291901.OAA48740@d0mino.fnal.gov \ --to=snyder@fnal.gov \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).