gcc 3.0 function pointer conversion problem.

jnance@numeritech.com jnance@numeritech.com
Tue Feb 20 09:45:00 GMT 2001


Hello All,
    I am trying to build some code that implicitly converts function pointers
into void pointers.  I dont think this is strictly legal c++, but 2.95.2
allowed it as do VC++, and the C++ compilers for Solaris, HP-UX, & AIX.
Was this feature intentionally removed, or did it just happen?  Here is an
example:

tarheels> cat x.cpp
int fun1(const int& a, const int& b, void **c) {}
void* fun2() {return fun1;}

tarheels> /tools/Lunix/bin/g++ -o /dev/null -c x.cpp
x.cpp: In function `void* fun2()':
x.cpp:2: cannot convert `int (*)(const int&, const int&, void**)' to `void*' in 
   return

Thanks,

Jim



More information about the Gcc-bugs mailing list