Created on 2005-06-03.00:00:00 last changed 197 months ago
[Voted into WP at the October, 2006 meeting.]
Proposed resolution (October, 2005):
Add the indicated words to 13.10.3.2 [temp.deduct.call] paragraph 4:
In general, the deduction process attempts to find template argument values that will make the deduced A identical to A (after the type A is transformed as described above). However, there are three cases that allow a difference:
If the original P is a reference type, the deduced A (i.e., the type referred to by the reference) can be more cv-qualified than the transformed A.
The transformed A can be another pointer or pointer to member type that can be converted to the deduced A via a qualification conversion (7.3.6 [conv.qual]).
If P is a class, and P has the form template-id, then the transformed A can be a derived class of the deduced A. Likewise, if P is a pointer to a class of the form template-id, the transformed A can be a pointer to a derived class pointed to by the deduced A.
Consider the following example:
char* cmdline3_[1] = {}; template<class charT> void func(const charT* const argv[]) {} int main() { func(cmdline3_); }
In terms of the process described in 13.10.3.2 [temp.deduct.call], P is const charT* const * and A is char*[1]. According to the first bullet in paragraph 2, the type used in deduction is not A but “the pointer type produced by the array-to-pointer standard conversion.”
According to paragraph 4,
In general, the deduction process attempts to find template argument values that will make the deduced A identical to A (after the type A is transformed as described above). However, there are three cases that allow a difference:
In this example, the deduced A is not identical to the transformed A, because the deduced A has additional cv-qualification, so the three exceptions must be examined to see if they apply. The only one that might apply is the second bullet of paragraph 4:
- A can be another pointer or pointer to member type that can be converted to the deduced A via a qualification conversion (7.3.6 [conv.qual]).
However, A is not a pointer type but an array type; this provision does not apply and deduction fails.
It has been argued that the phrase “after the type A is transformed as described above” should be understood to apply to the A in the three bullets of paragraph 4. If that is the intent, the wording should be changed to make that explicit.
History | |||
---|---|---|---|
Date | User | Action | Args |
2008-10-05 00:00:00 | admin | set | status: wp -> cd1 |
2007-05-06 00:00:00 | admin | set | status: dr -> wp |
2006-11-05 00:00:00 | admin | set | messages: + msg1448 |
2006-11-05 00:00:00 | admin | set | status: ready -> dr |
2006-04-22 00:00:00 | admin | set | status: review -> ready |
2005-10-22 00:00:00 | admin | set | messages: + msg1254 |
2005-10-22 00:00:00 | admin | set | status: open -> review |
2005-06-03 00:00:00 | admin | create |