Created on 2020-03-24.00:00:00 last changed 12 months ago
Proposed resolution:
This wording is relative to N4861.
Modify [algorithms.requirements] as indicated:
-15- The well-formedness and behavior of a call to an algorithm with an explicitly-specified template argument list is
number and order of deducible template parameters for algorithm declarations areunspecified, except where explicitly stated otherwise. [Note: Consequently, an implementation can declare an algorithm with different template parameters than those presentedthe algorithms may not be called with explicitly-specified template argument lists. — end note]
[ 2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP. ]
[ 2020-04-04 Issue Prioritization ]
Status set to Tentatively Ready after six positive votes on the reflector.
[algorithms.requirements]/15 says:
"The number and order of deducible template parameters for algorithm declarations are unspecified, except where explicitly stated otherwise. [Note: Consequently, the algorithms may not be called with explicitly-specified template argument lists. — end note]"
But the note doesn't follow from the normative rule. For example, we felt the need to explicitly allow deduction for min's template parameter:
template<typename T> const T& min(const T&, const T&);
… but if only the order and number of deducible template parameters is permitted to vary, then because of the required deduction behavior of this function template, there are only three possible valid declarations:
template<typename T> ??? min(const T&, const T&); template<typename T, typename U> ??? min(const T&, const U&); template<typename T, typename U> ??? min(const U&, const T&);
(up to minor differences in the parameter type). This doesn't prohibit calls with an explicitly-specified template argument list, contrary to the claim in the note. (Indeed, because a call such as min(1, {}) is valid, either the first of the above three overloads must be present or there must be a default template argument typename U = T, which further adds to the fact that there may be valid calls with an explicitly-specified template argument list.)
Also, the "explicitly stated otherwise" cases use phrasing such as: "An invocation may explicitly specify an argument for the template parameter T of the overloads in namespace std." which doesn't "specify otherwise" the normative rule, but does "specify otherwise" the claim in the note. All this leads me to believe that [algorithms.requirements]/15 is backwards: the normative rule should be a note and the note should be the normative rule.History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2020-11-09 21:40:50 | admin | set | messages: + msg11566 |
2020-11-09 21:40:50 | admin | set | status: ready -> wp |
2020-04-04 18:49:27 | admin | set | messages: + msg11188 |
2020-04-04 18:49:27 | admin | set | status: new -> ready |
2020-03-29 15:58:38 | admin | set | messages: + msg11179 |
2020-03-24 00:00:00 | admin | create |