"Ling-hua Tseng" <[EMAIL PROTECTED]> escreveu na mensagem

> What is the `target' in your program?
> The answer is NOTHING.
> So the set of overloaded functions is empty at beginning.

In my first example, the target type is the type of the address expression, 
i.e., the type of the source. I'll repeat it here:

template <class F> void bar(F f) {}
template <class T> void foo(T v) {}
void foo(int v) {}
...
bar(&foo);

According to the paragraph 2 of section 13.4, (and against of what I've said 
in my previous post), if there's a template function involved, the compiler 
tries to deduct the template arguments from the target type. If it succeeds, 
this specialization is added to the overload set. In my example, the 
compiler cannot deduct the template argument, so the template function 
doesn't get added to the overload set. Only the non-template function is 
added. Being the only function in the set, there's no ambiguity and the 
address of "void foo()" should be passed to "bar".

Best regards,
Rodolfo Lima. 



Reply via email to