I'm porting some MSVC code which I wrote to GCC but it failed to compile on GCC (see: https://ideone.com/UMzOuE).
template <const int N>
struct UnrolledOp
{
template <const int j, int op(int*, int*)>
static void Do(int* foo, int* l, int* r)
{
return UnrolledOp<N - 1>::Do<j + 4, op>(foo, l, r);
}
};
template <>
struct UnrolledOp<0>
{
template <const int j, int op(int*, int*)>
static void Do(int* foo, int* l, int* r) { }
};
template <const int fooSize, int op(int*, int*)>
void Op(int* foo, int* l, int* r)
{
UnrolledOp<fooSize / 4>::Do<0, op>(foo, l, r);
}
int Test(int* x, int* y)
{
return 0;
}
int main()
{
Op<16, Test>(nullptr, nullptr, nullptr);
return 0;
}
For some reason, GCC doesn't like the way I'm passing op
through to other template functions.