The following is a contrived example of actual code:
int** Ptr = 0;
decltype(Ptr[0]) Test = (int*)0;
I get an error message:
error C2440: 'initializing': cannot convert from 'int *' to 'int * &'
I am not sure why I get this, because from my understanding decltype(correct me if I am wrong), he simply accepts any expression that you give him and allow it to its actual type. In this case Ptr[0]there is int*, so I expect:int* Test = (int*)0;
What am I missing? Why am I getting this error?
source
share