Created on 2004-11-16.00:00:00 last changed 196 months ago
[Voted into WP at April, 2006 meeting.]
Proposed resolution (October, 2005):
Change the last sub-bullet of 13.10.3 [temp.deduct] paragraph 2 as indicated:
Attempting to create a function type in which a parameter has a type of void, or in which the return type is a function type or array type.
According to 13.10.3 [temp.deduct] paragraph 2,
If a substitution in a template parameter or in the function type of the function template results in an invalid type, type deduction fails.
That would seem to apply to cases like the following:
template <class T> T f(T&){} void f(const int*){} int main() { int a[5]; f(a); }
Here, the return type of f is deduced as int[5], which is invalid according to 9.3.4.6 [dcl.fct] paragraph 6. The outcome of this example, then, should presumably be that type deduction fails and overload resolution selects the non-template function. However, the list of reasons in 13.10.3 [temp.deduct] for which type deduction can fail does not include function and array types as a function return type. Those cases should be added to the list.
History | |||
---|---|---|---|
Date | User | Action | Args |
2008-10-05 00:00:00 | admin | set | status: wp -> cd1 |
2006-11-05 00:00:00 | admin | set | status: dr -> wp |
2006-04-22 00:00:00 | admin | set | messages: + msg1371 |
2006-04-22 00:00:00 | admin | set | status: ready -> dr |
2005-10-22 00:00:00 | admin | set | messages: + msg1225 |
2005-10-22 00:00:00 | admin | set | status: drafting -> ready |
2005-05-01 00:00:00 | admin | set | status: open -> drafting |
2004-11-16 00:00:00 | admin | create |