[Bug c++/11355] New: compilation involving static class members is affected by the presence of virtual destructor
mohit_aron at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Jun 28 00:31: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=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.
More information about the Gcc-bugs
mailing list