This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17182] New: [3.5 regression] virtual destructor not in shared library
- From: "Ralf dot Wildenhues at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Aug 2004 13:07:39 -0000
- Subject: [Bug c++/17182] New: [3.5 regression] virtual destructor not in shared library
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This example fails on CVS HEAD gcc (as of yesterday), but not 3.4, neither does
the original problem from which I stripped this example fail with CVS from 6
weeks ago.
/* Save this as a.cc
g++ -fPIC -DPIC -c -o a.o a.cc
g++ -shared a.o -o libfoo.so
Now, link a trivial program against it (int main(void) { }).
g++ -o b b.cc -L. -lfoo
*/
struct B {
virtual ~B () { }
virtual void dummy() { }
};
void bar()
{
struct C : public B {
C (const B& b) : B(b) { }
};
B b;
new C(b);
}
The error given is
./libfoo.so: undefined reference to `bar()::C::~C()'
./libfoo.so: undefined reference to `bar()::C::~C()'
with current gcc.
BTW, the 'new C(b);' line is not necessary with CVS HEAD to expose the bug.
With 3.4, however, class C is optimized away completely without this line.
Regards,
Ralf
--
Summary: [3.5 regression] virtual destructor not in shared
library
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Ralf dot Wildenhues at gmx dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17182