ambiguous function call




Hi,

the following code works in gcc, but not in VC8.0(SP1). Empirical evidence
suggests that visual studio is right (both Comeau and the Intel compiler
reject it), but I can't understand why the code should be ambiguous: x is a
reference to array, so an exact match should be preferred to
decay-into-pointer.
Can somebody help me understand?
Thanks,
MH


template <typename T>
void do_it_impl(const T* const x)
{
}

template <typename T, int K>
void do_it_impl(T (&x)[K])
{
}

template <typename T>
void do_it(T& x)
{
do_it_impl(x);
}

int main()
{
double a[30];
do_it(a);
}





.



Relevant Pages


Loading