------- Additional Comments From adah at netstd dot com 2005-08-08 03:53 ------- Sorry for the tone in my previous comment. I guess I was a little heated and acted in a haste.
This said, I still cannot think this bug report is `INVALID', from a user's point of view. The test code showed it clearly enough. However, this time let me try to see whether my point can find grounds in the current C++ Standard: 14.8.3/1: `When a call to that name is written (explicitly, or implicitly using the operator notation), template argument deduction (14.8.2) and checking of any explicit template arguments (14.3) are performed for each function template to find the template argument values (if any) that can be used with that function template to instantiate a function template specialization that can be invoked with the call arguments. For each function template, if the argument deduction and checking succeeds, the template-arguments (deduced and/or explicit) are used to instantiate a single function template specialization which is added to the candidate functions set to be used in overload resolution. If, for a given function template, argument deduction fails, no such function is added to the set of candidate functions for that template.' The instantiation is done after the `template argument deduction' is successful. Note it is `template argument deduction' but not `function argument deduction'. I fail to see why the return value type is not considered in the template argument deduction, though the Standard is somehow a little vague on this (I have found no explicit requirements or prohibitions.) By the way, the current error message for the instantiation failure is not helpful at all to help the user identify the problem! Yongwei -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15910