C++ ambiguous template instantiation
- by aaa
the following gives me ambiguous template instantiation with nvcc (combination of EDG front-end and g++).
Is it really ambiguous, or is compiler wrong? I also post workaround à la boost::enable_if
template<typename T> struct disable_if_serial { typedef void type; };
template<> struct disable_if_serial<serial_tag> { };
template<int M, int N, typename T>
__device__
//static typename disable_if_serial<T>::type
void add_evaluate_polynomial1(double *R,
const double (&C)[M][N], double x,
const T &thread) {
// ...
}
template<size_t M, size_t N>
__device__
static void add_evaluate_polynomial1(double *R,
const double (&C)[M][N], double x,
const serial_tag&) {
for (size_t i = 0; i < M; ++i)
add_evaluate_polynomial1(R, C, x, i);
}
// ambiguous template instantiation here.
add_evaluate_polynomial1(R, C, x, serial_tag());