volatile T* in a template function

Hi,

I cannot compile the following code:

Code:

`#include <iostream>`

template <typename T>

T some_func(volatile T* pointer, T argument1, T argument2)

{

return argument2;

}

int main(int argc, char* argv[]) {

volatile unsigned long long* pointer = (unsigned long long*)malloc(sizeof(unsigned long long));

unsigned long long* arg1 = (unsigned long long*)malloc(sizeof(unsigned long long));

unsigned long long* arg2 = (unsigned long long*)malloc(sizeof(unsigned long long));

*arg1 = (unsigned long long)4;

*arg2 = (unsigned long long)5;

unsigned long long* result = some_func<unsigned long long*>(&pointer, arg1, arg2);

printf("%lld\n", *result);

}

I'm getting the following compilation error:

Quote:

error: no matching function for call to ‘some_func(volatile long long unsigned int**, long long unsigned int*&, long long unsigned int*&)’

I have no idea why it does not compile.

Please help me out !

Many thanks in advance.

Camel.

but it is the same as in my first post

How come the code vijayan posted (with typedefs) works and mine (in the first post of this thread) does not ?

They are exactly the same ! (the same positions of "volatile" keywords)

As far as I know typedef is only an alias...