chatty%FRLRI61.BITNET@CUNYVM.CUNY.EDU (03/23/89)
Our g++ 1.33 shows a strange behaviour with non-overloaded friend functions
which have previously been declared as external : depending on the context,
it builds a normal symbol (like _foo), or a long one (like _foo_VOID), which
leads to undefined symbols when linking.
Here is the shortest example we found :
::::::::::::::
foo.h
::::::::::::::
extern void foo ();
class A {
friend void foo ();
};
::::::::::::::
foo.cc
::::::::::::::
#include "foo.h"
void foo ()
{
}
::::::::::::::
bar.cc
::::::::::::::
#include "foo.h"
main ()
{
foo ();
}
% g++ -c foo.cc bar.cc
% g++ -o bar foo.o bar.o
Undefined symbols:
_foo
% nm foo.o bar.o
foo.o:
00000000 T _foo_VOID <---------
00000000 t gcc_compiled. |
|--- ??????
bar.o: |
U _foo <-------------
00000000 T _main
00000000 t gcc_compiled.
That code is perhaps wrong, but I think it would deserve a warning, at least.
I forgot : g++ does the same on SUN3, SUN4, and HP9000s300.
Stephane CHATTY chatty@lri.lri.fr
L.R.I chatty@frlri61.bitnet
Universite de Paris-Sud