public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: harinath@cs.umn.edu To: gcc-gnats@gcc.gnu.org Cc: bsmedberg@covad.net Subject: c++/10804: regression from 3.2: implicit instantiation of template static methods Date: Thu, 15 May 2003 16:36:00 -0000 [thread overview] Message-ID: <20030515163149.20997.qmail@sources.redhat.com> (raw) >Number: 10804 >Category: c++ >Synopsis: regression from 3.2: implicit instantiation of template static methods >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu May 15 16:36:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: harinath@cs.umn.edu >Release: gcc version 3.4 20030512 (experimental) >Organization: >Environment: i686-pc-linux-gnu >Description: Linking fails on the following file: --8<-- template<class T> struct A { A() { const void (*a)() = foo; } static const void foo() {} }; int main(int argc, char *argv[]) { A<int> a; } --8<-- with the error: /tmp/ccube68X.o(.gnu.linkonce.t._ZN1AIiEC1Ev+0x9): In function `A<int>::A[in-charge]()': : undefined reference to `A<int>::foo()' collect2: ld returned 1 exit status There is no problem with GCC 3.2. >How-To-Repeat: c++ implicit-instantiation.cc Here's the output of nm with GCC 3.4: U A<int>::foo() 00000000 W A<int>::A[in-charge]() 00000000 T main and here's the output with GCC 3.2 00000000 W A<int>::foo() 00000000 W A<int>::A[in-charge]() U __gxx_personality_v0 00000000 T main Notice that GCC 3.4 did DTRT with the constructor. If I replace the use of foo in the code with a direct method call, then there's no problem either. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/x-c++src; name="implicit-instantiation.cc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="implicit-instantiation.cc" dGVtcGxhdGU8Y2xhc3MgVD4Kc3RydWN0IEEKewogIEEoKSB7IGNvbnN0IHZvaWQgKCphKSgpID0g Zm9vOyB9CiAgc3RhdGljIGNvbnN0IHZvaWQgZm9vKCkge30KfTsKCmludCBtYWluKGludCBhcmdj LCBjaGFyICphcmd2W10pCnsKICBBPGludD4gYTsKfQo=
reply other threads:[~2003-05-15 16:36 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=20030515163149.20997.qmail@sources.redhat.com \ --to=harinath@cs.umn.edu \ --cc=bsmedberg@covad.net \ --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).