hurcan solter <hsolter@gmail.com> wrote:
given the code snippet;
template<typename T>
void foo(T,T){}
template<typename T1,typename T2>
void foo(T1*,T2*){}
int main( ) {
foo((int*)0,(int*)0);
}
Could anyone please explain me why the second template is not more
viable for overload resolution?
[...]
From <http://www.comeaucomputing.com/tryitout/>:
Comeau C/C++ 4.3.9 (Mar 27 2007 17:24:47) for ONLINE_EVALUATION_BETA1
Copyright 1988-2007 Comeau Computing. All rights reserved.
MODE:strict errors C++ C++0x_extensions
"ComeauTest.c", line 9: error: more than one instance of overloaded
function "foo"
matches the argument list, the choices that match are:
function template "void foo(T, T)"
function template "void foo(T1 *, T2 *)"
The argument types that you used are: (int *, int *)
foo((int*)0,(int*)0);
^
1 error detected in the compilation of "ComeauTest.c".
Thanks in advance.
HTH,
Schobi