This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g++ bug -- local classes
- To: gcc-bugs at gcc dot gnu dot org
- Subject: g++ bug -- local classes
- From: Stepan Kasal <kasal at suse dot cz>
- Date: Tue, 15 Feb 2000 10:08:27 +0100
Hallo,
with gcc 2.95.2 on ix86, the source below, and command-line
g++ -O -c test.cc
one gets test.o containing these symbols:
U _._Q38DataView25updateGraphs__8DataView.0_7Updater.7
U doIt__Q38DataView25updateGraphs__8DataView.0_7Updater.6
it means:
kasal@titan$ nm test.o |grep Updater|sed -n 's/\.[0-9]*$/ &/p'|c++filt
U DataView::updateGraphs__8DataView.0::Updater::~Updater(void) .7
00000000 W DataView::updateGraphs__8DataView.0::Updater::Updater(void) .8
U DataView::updateGraphs__8DataView.0::Updater::doIt(void) .6
Surely these symbols will never link to anything in any other module.
Of course removing "#pragma implementation" works, but I don't want to
duplicate code in objects.
Making the class global also works but it's nicer to have it local.
I'm on the list, and I'll answer questions.
As usual thanks to all who work on gcc & g++.
Stepan Kasal
============ test.ii
# 1 "test.cc"
#pragma implementation
# 1 "test.h" 1
#pragma interface
class Block {
public:
virtual ~Block() {}
virtual void doIt()=0;
};
# 2 "test.cc" 2
class DataView {
public:
void updateGraphs() {
class Updater : public Block {
public:
void doIt() {}
} updater;
updater.doIt();
}
};
============ that's it