Re: static function pointers in C++ template class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So, I kind of figured it out.  Now I'm seeing some strange behavior
with instantiation of  templated classes that is dependent on the
position of the code in the file.  If I have:

template <dSpaceID>
typename udata<dSpaceID>::fptr udata<dSpaceID>::kill_func = dSpaceDestroy;

template <dWorldID>
typename udata<dWorldID>::fptr udata<dWorldID>::kill_func = dWorldDestroy;

I get the error:
lua_ode.cpp:28: error: invalid conversion from 'void (*)(dxWorld*)' to
'void (*)(dxSpace*)'

If I swap the order of the 2 declarations, I get:

lua_ode.cpp:28: error: invalid conversion from 'void (*)(dxSpace*)' to
'void (*)(dxWorld*)'


Why would that happen?  My gcc version is:
gcc version 4.0.1 (Apple Computer, Inc. build 5341)

thanks,
wes

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux