I have some code which "works" in VS2008 in that it will build and run and do what I expect. However I have a build error in VS2013, I've managed to reproduce it with just this code:
#include "stdafx.h"
#include <Windows.h>
#include <vector>
template < class T >
class SignatureScanner
{
public:
SignatureScanner(const BYTE* aPattern, const char* aMask, int aExpectedMatches = 1, int aOffSetToFuncStart = 0)
{
}
const std::vector<T> Funcs() const
{
return iFuncs;
}
private:
std::vector<T> iFuncs;
};
// Workaround/hack to define a thiscall function
static void __fastcall fake_this_call_func(void *thisPtr, void* not_used_hack, int aParam)
{
printf("this [%x] param [%d]\n", thisPtr, aParam);
}
// type_traits(396): error C3865: '__thiscall' : can only be used on native member functions
int _tmain(int argc, _TCHAR* argv[])
{
typedef void(__thiscall* myFuncPtr)(int thisPtr, int aParam);
// I use this in some hook code to find a function and redirect it to fake_this_call_func
// which works when it builds
SignatureScanner< myFuncPtr > p(0, 0);
return 0;
}
I want to know why did 2008 not have an error when 2013 does, and how should I go about resolving this error? It only needs to build for Windows XP 32-bit - so platform specific hacks are OK.