call cudaCreateChannelDesk from template class how to tell compiler that cudaCreateChannelDesk is te

GCC will not compile following code snippet (which in fact is correct behavior of GCC as it is conform to the standard c++)

template<class T>

void CUDAMemory1D2DTextureAllocator<T>::allocateMemoryOnDevice()

{

    m_pChannelDesc = cudaCreateChannelDesc<T>();    // this gives compile error in gcc (msvc compiles fine)

    cudaError_t result = cudaMallocArray( &m_pDeviceMemory, &m_pChannelDesc, m_pWidth, m_pHeight);

    ...

}

One needs to tell the compiler that cudaCreateChannelDesc is a template method. Otherwise it will try to

parse < as a smaller than operator…

The following snippet shows that in an easy example:

template< typename G >

struct Test

{

    template< typename T > T f() const;

};

template< typename G, typename T >

 void g()

 {

     Test< G > t;

t.f< T >();           // ERROR: gcc won't compile that

     t.template f< T >();  // OK: now gcc knows that f is a template method an treads the following angle brackets not as operators but as template brackets...

 }

So far so good. Now my question is, how to do that in the above case, where the method i call is cudaCreateChannelDesc which does not belong to any class or namespace???

Any advice or suggestion how to solve this situation are very welcome.

Thanks

Tobi