[Bug c++/17121] New: Link problem with function-local classes
Richard dot Kreckel at Framatome-ANP dot com
gcc-bugzilla@gcc.gnu.org
Fri Aug 20 14:46:00 GMT 2004
$ g++ -v
Reading specs from
/data/scratch/devtools/gcc-3.5.0-pre-20040815/lib/gcc/i686-pc-linux-gnu/3.5.0/specs
Configured with: ../gcc-3.5-20040815/configure
--prefix=/data/scratch/devtools/gcc-3.5.0-pre-20040815 --enable-languages=c,c++
--with-as=/data/scratch/binutils/2.15/bin/as
--with-ld=/data/scratch/binutils/2.15/bin/ld --enable-__cxa_atexit --disable-nls
i686-pc-linux-gnu
Thread model: posix
gcc version 3.5.0 20040815 (experimental)
$ cat test.cc
struct A {
virtual ~A() {}
};
void tsk_tsk()
{
struct B : public A {};
}
$ cat main.cc
int main() {}
$ g++ -W -Wall -c test.cc
$ g++ -W -Wall main.cc test.o
test.o(.text+0x19): In function `tsk_tsk()':
: undefined reference to `vtable for tsk_tsk()::B'
test.o(.text+0x1d): In function `tsk_tsk()':
: undefined reference to `tsk_tsk()::B::~B()'
test.o(.text+0x23): In function `tsk_tsk()':
: undefined reference to `vtable for tsk_tsk()::B'
test.o(.text+0x27): In function `tsk_tsk()':
: undefined reference to `tsk_tsk()::B::~B()'
collect2: ld returned 1 exit status
As far as I can tell, this used to work with all releases of GCC.
--
Summary: Link problem with function-local classes
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Richard dot Kreckel at Framatome-ANP dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17121
More information about the Gcc-bugs
mailing list