Created on 2007-02-16.00:00:00 last changed 130 months ago
[Voted into WP at August, 2010 meeting.]
Proposed resolution (March, 2010):
This issue is resolved by the resolution of issue 873.
Proposed resolution (February, 2010):
Add the following paragraph at the end of 13.7.7 [temp.fct]:
In a declaration that names a specialization of a function template, template arguments can be deduced from the function type. [Note: this can occur in the context of an explicit specialization, an explicit instantiation, or a friend declaration. —end note] The function template's function type and the declared type are used as the types of P and A and the deduction is done as described in 13.10.3.6 [temp.deduct.type].
Notes from the September, 2008 meeting:
The proposed resolution is probably more than is needed. Instead of a complete new section, the material could become a paragraph in 13.7.7 [temp.fct].
Proposed resolution (March, 2008):
Insert the following as a new subsection after 13.10.3.6 [temp.deduct.type]:
14.9.2.6 Deducing template arguments in a declaration that names a specialization of a function template [temp.deduct.funcdecl] Template arguments can be deduced from the function type specified when declaring a specialization of a function template. [Note: this can occur in the context of an explicit specialization, an explicit instantiation, or a friend declaration. —end note] The function template's function type and the declared type are used as the types of P and A, and the deduction is done as described in 13.10.3.6 [temp.deduct.type].
Change 13.9.4 [temp.expl.spec] paragraph 11 as follows:
A trailing template-argument can be left unspecified in the template-id naming an explicit function template specialization provided it can be deduced from the functionargumenttype (14.9.2.6 [temp.deduct.funcdecl])...
It does not appear that the following example is well-formed, although most compilers accept it:
template <typename T> T foo(); template <> int foo();
The reason is that 13.9.4 [temp.expl.spec] paragraph 11 only allows trailing template-arguments to be omitted if they “can be deduced from the function argument type,” and there are no function arguments in this example.
13.9.4 [temp.expl.spec] should probably say “function type” instead of “function argument type.” Also, a subsection should probably be added to 13.10.3 [temp.deduct] to cover “Deducing template arguments from declarative contexts” or some such. It would be essentially the same as 13.10.3.3 [temp.deduct.funcaddr] except that the function type from the declaration would be used as the type of P.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: fdis -> c++11 |
2011-04-10 00:00:00 | admin | set | status: wp -> fdis |
2010-11-29 00:00:00 | admin | set | status: dr -> wp |
2010-08-23 00:00:00 | admin | set | messages: + msg2930 |
2010-08-23 00:00:00 | admin | set | status: ready -> dr |
2010-03-29 00:00:00 | admin | set | messages: + msg2574 |
2010-03-29 00:00:00 | admin | set | status: review -> ready |
2010-02-16 00:00:00 | admin | set | messages: + msg2565 |
2010-02-16 00:00:00 | admin | set | status: drafting -> review |
2008-10-05 00:00:00 | admin | set | messages: + msg1785 |
2008-10-05 00:00:00 | admin | set | status: review -> drafting |
2008-05-18 00:00:00 | admin | set | messages: + msg1640 |
2008-05-18 00:00:00 | admin | set | status: drafting -> review |
2007-05-06 00:00:00 | admin | set | status: open -> drafting |
2007-02-16 00:00:00 | admin | create |