I have some code that uses GMP which compiles and runs fine with g++.
...
// get ptrs to GMP memory management functions
void *(*alloc_func_ptr) (size_t);
void *(*free_func_ptr) (void *, size_t);
mp_get_memory_functions(&alloc_func_ptr, NULL, &free_func_ptr);
...
But when i compile it with the most recent clang++ it throws this error
gmpxx_boost_serialization.h:127: error: no matching function for call to '__gmp_get_memory_functions'
mp_get_memory_functions(&alloc_func_ptr, NULL, &free_func_ptr);
where mp_get_memory_functions is a macro
#define mp_get_memory_functions __gmp_get_memory_functions
__GMP_DECLSPEC void mp_get_memory_functions (void *(**) (size_t),
void *(**) (void *, size_t, size_t),
void (**) (void *, size_t)) __GMP_NOTHROW;
Why does clang complain?
try changing:
void *(*free_func_ptr) (void *, size_t);
to:
void (*free_func_ptr) (void *, size_t);
As per the declaration, third argument to "mp_get_memory_functions" is address of the function pointer ( to function which returns "void" and not "void *" )