C++ bug when using extern "C"

Dirk De Rycke dirk.de.rycke@chello.be
Fri Jul 13 14:03:00 GMT 2001


Hi,

Today I may have hit a bug in g++.
Try compiling the following program with g++ -c

extern "C" {
  void xxx(void (*f)());
  void yyy(void (*f)(void));
}

void xxx(void (*f)())
{
}

void yyy(void (*f)(void))
{
}

After compiling examine the object file with nm -s you get the following
symbols

[dirk@hades dirk]$ nm -s cppbug.o
00000000 ? __FRAME_BEGIN__
00000000 t gcc2_compiled.
00000000 T xxx__FPFv_v
0000000c T yyy

So the first function still has C++ name mangling and seems to ignore
the extern "C",
adding the void to the second function solves the  problem. Is this a
bug or a known feature
for some strange reason? If it is a bug can somebody try it on the GCC
3.0?

My compiler version is
Reading specs from /usr/lib/gcc-lib/i586-pld-linux/2.95.3/specs
gcc version 2.95.3 20010315 (release)

regards,

Dirk De Rycke


More information about the Gcc-bugs mailing list