g++ bug -- local classes
Stepan Kasal
kasal@suse.cz
Tue Feb 15 01:08:00 GMT 2000
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
More information about the Gcc-bugs
mailing list