I’m using a C library (from C++) which provides the following interface:
void register_callback(void* f, void* data);
void invoke_callback(
Apparently, the real problem was the missing static_cast in my original code:
register_callback(reinterpret_cast(&my_callback), &ft);
This compiles fine, but triggers the liker error when using GCC 4.5. It doesn’t even compile when using GCC 4.2, instead giving the following compile error:
insufficient contextual information to determine type
Once this “contextual information” is provided, the code compiles and links:
register_callback(reinterpret_cast(
static_cast(my_callback)), &value);
I’ve got no idea whether the cast is actually required and (if so) why GCC 4.5 allows me to leave it off, and then fails to instantiate the template. But at least I got the code to compile without resorting to hacks.