https://godbolt.org/z/d5ha1EEj4
change the using WinAPIGLFunc = attribute((ms_abi)) GLFunc; to using WinAPIGLFunc = attribute((ms_abi)) Result (*)(Args...); and it doesnt crash
#include <stdint.h>
#include <utility>
template<class T>
class GLFunctor;
template<class Result, class... Args>
class GLFunctor<Result (Args...)>
{
using GLFunc = Result (*)(Args...);
public:
Result operator()(Args... args) const
{
using WinAPIGLFunc = __attribute__((ms_abi)) GLFunc;
return reinterpret_cast<WinAPIGLFunc>(glProc)(std::forward<Args>(args)...);
}
private:
GLFunc glProc = nullptr;
};
GLFunctor<void (int pname)> test_functor;
void Test()
{
test_functor(0);
}
https://godbolt.org/z/d5ha1EEj4
change the using WinAPIGLFunc = attribute((ms_abi)) GLFunc; to using WinAPIGLFunc = attribute((ms_abi)) Result (*)(Args...); and it doesnt crash