Title
Confusing aspects in the specification of non-deduced contexts
Status
cd1
Section
13.10.3.6 [temp.deduct.type]
Submitter
Mike Miller

Created on 2005-07-25.00:00:00 last changed 196 months ago

Messages

Date: 2006-10-15.00:00:00

[Voted into WP at the October, 2006 meeting.]

Date: 2005-10-15.00:00:00

Proposed resolution (October, 2005):

  1. Change 13.10.3.6 [temp.deduct.type] paragraph 5 as indicated:

  2. The non-deduced contexts are:

    • The nested-name-specifier of a type that was specified using a qualified-id.

    • A non-type template argument or an array bound that is an expression that in either of which a subexpression references a template parameter.

    • A template parameter used in the parameter type of a function parameter that has a default argument that is being used in the call for which argument deduction is being done.

    • A function parameter for which argument deduction cannot be done because the associated function argument is a function, or a set of overloaded functions (12.3 [over.over]), and one or more of the following apply:

      • more than one function matches the function parameter type (resulting in an ambiguous deduction), or

      • no function matches the function parameter type, or

      • the set of functions supplied as an argument contains one or more function templates.

    • An array bound that is an expression that references a template-parameter.

  3. Change 13.10.3.6 [temp.deduct.type] paragraph 14 as indicated:

  4. If, in the declaration of a function template with a non-type template parameter, the non-type template parameter is used in an expression a subexpression in the function parameter list, the expression is a non-deduced context as specified above...
  5. Change 13.8.3.2 [temp.dep.type] paragraph 3 as indicated:

  6. A template argument that is equivalent to a template parameter (i.e., has the same constant value or the same type as the template parameter) can be used in place of that template parameter in a reference to the current instantiation. In the case of a non-type template argument, the argument must have been given the value of the template parameter and not an expression involving that contains the template parameter as a subexpression...
Date: 2005-07-25.00:00:00

13.10.3.6 [temp.deduct.type] paragraph 5 reads:

The non-deduced contexts are:

  • The nested-name-specifier of a type that was specified using a qualified-id.

  • A non-type template argument or an array bound that is an expression that references a template parameter.

  • A template parameter used in the parameter type of a function parameter that has a default argument that is being used in the call for which argument deduction is being done.

  • A function parameter for which argument deduction cannot be done because the associated function argument is a function, or a set of overloaded functions (12.3 [over.over]), and one or more of the following apply:

    • more than one function matches the function parameter type (resulting in an ambiguous deduction), or

    • no function matches the function parameter type, or

    • the set of functions supplied as an argument contains one or more function templates.

  • An array bound that is an expression that references a template-parameter.

There are two problems with this list:

  1. The last bullet is redundant with the second bullet. This appears to have been the result of applying the resolutions of issues 70 and 352 independently instead of in coordination.

  2. The second bullet appears to be contradicted by the statement in paragraph 8 saying that an argument can be deduced if P and A have the forms type[i] and template-name<i>.

    The intent of the wording in bullet 2 appears to have been that deduction cannot be done if the template parameter is a sub-expression of the template argument or array bound expression and that it can be done if it is the complete expression, but the current wording does not say that very clearly. (Similar wording also appears in 13.8.3.2 [temp.dep.type] paragraph 3 and 13.10.3.6 [temp.deduct.type] paragraph 14.)

History
Date User Action Args
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2007-05-06 00:00:00adminsetstatus: dr -> wp
2006-11-05 00:00:00adminsetmessages: + msg1449
2006-11-05 00:00:00adminsetstatus: ready -> dr
2006-04-22 00:00:00adminsetstatus: review -> ready
2005-10-22 00:00:00adminsetmessages: + msg1255
2005-10-22 00:00:00adminsetstatus: open -> review
2005-07-25 00:00:00admincreate