Apologies if this is a basic misunderstanding of how C++ works, but to me this looks like a bug. I am tracking down an ODR violation message that LTO is emitting when linking two TUs that include the same header file, but whose IL was generated with different front ends:
$ cat f.h typedef const char * (*Callback)(void *, const char *, const int); $ cat f1.cc #include "f.h" extern "C" { extern Callback p; }; $ cat f2.c #include "f.h" Callback p = 0; $ g++ -flto -c f1.cc $ gcc -flto -c f2.c $ gcc -flto -o f f1.o f2.o f2.c:2: error: type of 'p' does not match original declaration f1.cc:2: error: previously declared here The reason why we get into this error is that in the C++ FE, the typedef for Callback removes 'const' from the third argument. This is what I see when debugging cc1plus just before it writes the IL to disk: (gdb) ptu 0x7ffff79f2cc0 $NODE =$10 = 0x7ffff79f2cc0 const char * (*JSErrorCallback) (void *, const char *, int) Notice how the third argument is 'int' instead of 'const int'. Is this the way C++ is supposed to behave or is this a bug in the FE? Thanks. Diego.