This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11355] New: compilation involving static class members is affected by the presence of virtual destructor
- From: "mohit_aron at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Jun 2003 00:31:43 -0000
- Subject: [Bug c++/11355] New: compilation involving static class members is affected by the presence of virtual destructor
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11355
Summary: compilation involving static class members is affected
by the presence of virtual destructor
Product: gcc
Version: 2.95.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mohit_aron at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
Consider a class Foo defined in header file foo.h, with a static method in Foo
called Bar. Lets say foo.cc includes the header file foo.h and uses Foo::Bar().
Here are the following cases:
1) Class Foo has no virtual destructor. In this case the following commands:
g++ -c -fno-inline foo.cc
nm -n foo.o | grep Bar
shows Bar to be defined as a weak symbol.
2) Class Foo has a virtual destructor declared (but not defined) AND the
definition is not present in foo.cc
g++ -c -fno-inline foo.cc
nm -n foo.o | grep Bar
shows Bar to be defined as an undefined symbol (this is the bug)
3) Class Foo has a virtual destructor declared AND the definition of the
destructor is present in foo.cc:
g++ -c -fno-inline foo.cc
nm -n foo.o | grep Bar
shows Bar to be defined as a weak symbol.
The bug is demonstrated by case (2) above.