Fix for error on Clang compiler: reinterpret_cast from 'const void *' to 'FunctionType *' (aka 'void (*)(EngineObject *, const char *, const char *)') casts away qualifiers

return R( reinterpret_cast< FunctionType const* >( /*const_cast<void*>*/(mFn) )( mThis, a, b ) );
This commit is contained in:
LuisAntonRebollo 2014-05-05 19:57:04 +02:00
parent 17bd69e659
commit 82bb19e1b5

View file

@ -2533,79 +2533,79 @@ struct _EngineCallbackHelper
R call() const R call() const
{ {
typedef R( FunctionType )( EngineObject* ); typedef R( FunctionType )( EngineObject* );
return R( reinterpret_cast< FunctionType* >( mFn )( mThis ) ); return R( reinterpret_cast< FunctionType* >( const_cast<void*>(mFn) )( mThis ) );
} }
template< typename R, typename A > template< typename R, typename A >
R call( A a ) const R call( A a ) const
{ {
typedef R( FunctionType )( EngineObject*, A ); typedef R( FunctionType )( EngineObject*, A );
return R( reinterpret_cast< FunctionType* >( mFn )( mThis, a ) ); return R( reinterpret_cast< FunctionType* >( const_cast<void*>(mFn) )( mThis, a ) );
} }
template< typename R, typename A, typename B > template< typename R, typename A, typename B >
R call( A a, B b ) const R call( A a, B b ) const
{ {
typedef R( FunctionType )( EngineObject*, A, B ); typedef R( FunctionType )( EngineObject*, A, B );
return R( reinterpret_cast< FunctionType* >( mFn )( mThis, a, b ) ); return R( reinterpret_cast< FunctionType* >( const_cast<void*>(mFn) )( mThis, a, b ) );
} }
template< typename R, typename A, typename B, typename C > template< typename R, typename A, typename B, typename C >
R call( A a, B b, C c ) const R call( A a, B b, C c ) const
{ {
typedef R( FunctionType )( EngineObject*, A, B, C ); typedef R( FunctionType )( EngineObject*, A, B, C );
return R( reinterpret_cast< FunctionType* >( mFn )( mThis, a, b, c ) ); return R( reinterpret_cast< FunctionType* >( const_cast<void*>(mFn) )( mThis, a, b, c ) );
} }
template< typename R, typename A, typename B, typename C, typename D > template< typename R, typename A, typename B, typename C, typename D >
R call( A a, B b, C c, D d ) const R call( A a, B b, C c, D d ) const
{ {
typedef R( FunctionType )( EngineObject*, A, B, C, D ); typedef R( FunctionType )( EngineObject*, A, B, C, D );
return R( reinterpret_cast< FunctionType* >( mFn )( mThis, a, b, c, d ) ); return R( reinterpret_cast< FunctionType* >( const_cast<void*>(mFn) )( mThis, a, b, c, d ) );
} }
template< typename R, typename A, typename B, typename C, typename D, typename E > template< typename R, typename A, typename B, typename C, typename D, typename E >
R call( A a, B b, C c, D d, E e ) const R call( A a, B b, C c, D d, E e ) const
{ {
typedef R( FunctionType )( EngineObject*, A, B, C, D, E ); typedef R( FunctionType )( EngineObject*, A, B, C, D, E );
return R( reinterpret_cast< FunctionType* >( mFn )( mThis, a, b, c, d, e ) ); return R( reinterpret_cast< FunctionType* >( const_cast<void*>(mFn) )( mThis, a, b, c, d, e ) );
} }
template< typename R, typename A, typename B, typename C, typename D, typename E, typename F > template< typename R, typename A, typename B, typename C, typename D, typename E, typename F >
R call( A a, B b, C c, D d, E e, F f ) const R call( A a, B b, C c, D d, E e, F f ) const
{ {
typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F ); typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F );
return R( reinterpret_cast< FunctionType* >( mFn )( mThis, a, b, c, d, e, f ) ); return R( reinterpret_cast< FunctionType* >( const_cast<void*>(mFn) )( mThis, a, b, c, d, e, f ) );
} }
template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G >
R call( A a, B b, C c, D d, E e, F f, G g ) const R call( A a, B b, C c, D d, E e, F f, G g ) const
{ {
typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G ); typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G );
return R( reinterpret_cast< FunctionType* >( mFn )( mThis, a, b, c, d, e, f, g ) ); return R( reinterpret_cast< FunctionType* >( const_cast<void*>(mFn) )( mThis, a, b, c, d, e, f, g ) );
} }
template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H >
R call( A a, B b, C c, D d, E e, F f, G g, H h ) const R call( A a, B b, C c, D d, E e, F f, G g, H h ) const
{ {
typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H ); typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H );
return R( reinterpret_cast< FunctionType* >( mFn )( mThis, a, b, c, d, e, f, g, h ) ); return R( reinterpret_cast< FunctionType* >( const_cast<void*>(mFn) )( mThis, a, b, c, d, e, f, g, h ) );
} }
template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I >
R call( A a, B b, C c, D d, E e, F f, G g, H h, I i ) const R call( A a, B b, C c, D d, E e, F f, G g, H h, I i ) const
{ {
typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H, I ); typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H, I );
return R( reinterpret_cast< FunctionType* >( mFn )( mThis, a, b, c, d, e, f, g, h, i ) ); return R( reinterpret_cast< FunctionType* >( const_cast<void*>(mFn) )( mThis, a, b, c, d, e, f, g, h, i ) );
} }
template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J >
R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j ) const R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j ) const
{ {
typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H, I, J ); typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H, I, J );
return R( reinterpret_cast< FunctionType* >( mFn )( mThis, a, b, c, d, e, f, g, h, i, j ) ); return R( reinterpret_cast< FunctionType* >( const_cast<void*>(mFn) )( mThis, a, b, c, d, e, f, g, h, i, j ) );
} }
template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K >
R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k ) const R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k ) const
{ {
typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H, I, J, K ); typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H, I, J, K );
return R( reinterpret_cast< FunctionType* >( mFn )( mThis, a, b, c, d, e, f, g, h, i, j, k ) ); return R( reinterpret_cast< FunctionType* >( const_cast<void*>(mFn) )( mThis, a, b, c, d, e, f, g, h, i, j, k ) );
} }
template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L >
R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l ) const R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l ) const
{ {
typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H, I, J, K, L l ); typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H, I, J, K, L l );
return R( reinterpret_cast< FunctionType* >( mFn )( mThis, a, b, c, d, e, f, g, h, i, j, k, l ) ); return R( reinterpret_cast< FunctionType* >( const_cast<void*>(mFn) )( mThis, a, b, c, d, e, f, g, h, i, j, k, l ) );
} }
}; };