[Bug c++/11120] New: gcc 3.4 doesn't emit code for template methods used through function pointers
lars@trolltech.com
gcc-bugzilla@gcc.gnu.org
Fri Jun 6 22:30:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11120
Summary: gcc 3.4 doesn't emit code for template methods used
through function pointers
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: lars@trolltech.com
CC: gcc-bugs@gcc.gnu.org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
The code below gives an undefined reference to Bar<T>::bar(). The same code
compiles and links fine in 3.2.
int foo( int(* bar)() )
{
return bar();
}
template<class T> class Bar
{
public:
static int bar();
int baz();
};
template<class T>
int Bar<T>::bar()
{
return 1;
}
template<class T>
int Bar<T>::baz()
{
return foo(bar);
}
int main(int argc, char **argv)
{
Bar<int> b;
return b.baz();
}
[lars@binky gcc-bugs]$ gcc function_ptr.cpp
/tmp/cc4c2Aaa.o: In function `Bar<int>::baz()':
/tmp/cc4c2Aaa.o(.gnu.linkonce.t._ZN3BarIiE3bazEv+0x9): undefined reference to
`Bar<int>::bar()'
/tmp/cc4c2Aaa.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
[lars@binky gcc-bugs]$ gcc -v
Reading specs from /home/lars/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc/configure --prefix=/home/lars/gcc --disable-libgcj
Thread model: posix
gcc version 3.4 20030605 (experimental)
More information about the Gcc-bugs
mailing list