This code compiles OK on g++ (Coliru), but not Visual C++ (rextester) - both online and my desktop.
It is a simplified version of a much larger Visual Studio 2015 project.
class AAA{
public: template<class T> static T* test(T* hqi){
return hqi;
}
};
class TTT3{
public: int d; //In real case, it is some class, but same error nonetheless.
decltype(AAA::test(&d)) dfd=AAA::test(&d); //<-- error only Visual C++
};
int main(){
int b;
decltype(AAA::test(&b)) dfd=AAA::test(&b); //OK for boths
}
'T *AAA::test(T *)': could not deduce template argument for 'T ' from 'int TTT3:: '
Question
- Why? Is my code wrong? - I don't think so.
- How to make it compile in Visual C++? I need it.