------- Comment #1 from hjl dot tools at gmail dot com 2009-02-14 00:38 ------- [...@gnu-6 936]$ cat x.cc #include "foo.h"
int * x (void) { return f (); } [...@gnu-6 936]$ cat y.cc #include <stdio.h> #include "foo.h" extern int *x (void); int main () { printf ("%p, %p\n", x (), f ()); return 0; } [...@gnu-6 936]$ cat foo.h inline int * f () { static union { const char *p; int i; }; return &i; } [...@gnu-6 936]$ g++ x.cc y.cc -O2 [...@gnu-6 936]$ ./a.out 0x600a38, 0x600a40 [...@gnu-6 936]$ nm x.o | c++filt 0000000000000000 W f() 0000000000000000 T x() 0000000000000000 b f()::p U __gxx_personality_v0 f()::p should be global and linkonce. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39188