This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++ bug when using extern "C"


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]