The following compiles on Visual Studio:
template<typename ArgType, typename ReturnType>
struct Test
{
using FunctionPointerType = std::conditional_t<
std::is_same_v<ArgType, void>
, ReturnType(*)()
, ReturnType(*)(ArgType)
>;
FunctionPointerType Func;
};
int main()
{
Test<void, char> tt;
}
But does not compile on Linux g++. The error I get is
error : invalid parameter type ‘void’
I know I cannot use void in templates, which is why I have used std::conditional_t and std::is_same_v.
I cannot see what is incorrect, can someone please tell me?