public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10804: regression from 3.2: implicit instantiation of template static methods
@ 2003-05-15 16:36 harinath
0 siblings, 0 replies; only message in thread
From: harinath @ 2003-05-15 16:36 UTC (permalink / raw)
To: gcc-gnats; +Cc: bsmedberg
>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=
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-05-15 16:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-15 16:36 c++/10804: regression from 3.2: implicit instantiation of template static methods harinath
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).