On Thu, 19 Jul 2007 19:25:38 -0300, Rodolfo Lima wrote > If I understand this correctly, when we have the following declarations: > > template <class T> void foo() {} > void foo() {} > > The overload set for "&foo" at first contains all "void foo<T>()" > and "void foo()". Then, because of the presence of the latter, the > former should be eliminated. In the end, only "void foo()" remains, > and we have no ambiguity. You forgot the hypothesis in the paragraph 1: "The function selected is the one whose type matches the target type required in the context. The target can be an object or reference being initialized (8.5, 8.5.3), the left side of an assignment (5.17), a parameter of a function (5.2.2), a parameter of a user-defined operator (13.5), the return value of a function, operator function, or conversion (6.6.3), an explicit type conversion (5.2.3, 5.2.9, 5.4), or a non-type template-parameter (14.3.2)."
What is the `target' in your program? The answer is NOTHING. So the set of overloaded functions is empty at beginning. The following case can compile by g++: void (*fptr)() = &print; It's because it has the `target'. Your deduction can apply to this case, but it cannot apply to your example code.