Created on 2022-04-26.00:00:00 last changed 2 months ago
Additional notes (July, 2024)
The example in this issue is resolved by issue 2918 by suitably ordering placeholder type deduction before the address operation.
Proposed resolution:
Change in 12.3 [over.over] paragraph 5 as follows:
AnyIf there is a target, any given function template specialization F1 is eliminated if the set contains a second function template specialization whose function template is more specialized than the function template of F1 according to the partial ordering rules of 13.7.7.3 [temp.func.order]. After such eliminations, if any, there shall remain exactly one selected function.
Suggested resolution [SUPERSEDED]:
Change in 12.3 [over.over] paragraph 5 as follows:
Any given function template specialization F1 is eliminated if the set contains a second function template specialization whose function template ismore specializedbetter than the function template of F1. If there is no target, a function template is better than another if it is more constrained than the other; otherwise a function template is better than another if it is more specialized than the other according to the partial ordering rules of 13.7.7.3 [temp.func.order]. After such eliminations, if any, there shall remain exactly one selected function.
Consider:
template <class T> T f(T); // #1 template <class T> T* f(T*); // #2 auto p = &f<int>;
Accoring to 12.3 [over.over] paragraph 3 and 12.3 [over.over] paragraph 5:
The specialization, if any, generated by template argument deduction (13.10.4 [temp.over], 13.10.3.3 [temp.deduct.funcaddr], 13.10.2 [temp.arg.explicit]) for each function template named is added to the set of selected functions considered.
[...]Any given function template specialization F1 is eliminated if the set contains a second function template specialization whose function template is more specialized than the function template of F1 according to the partial ordering rules of 13.7.7.3 [temp.func.order]. After such eliminations, if any, there shall remain exactly one selected function.
Major implementations reject the example as ambiguous, yet the wording specifies to unambiguously choose #2.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-08-01 12:33:59 | admin | set | messages: + msg7781 |
2023-06-20 19:34:52 | admin | set | messages: + msg7332 |
2023-06-20 19:34:52 | admin | set | status: open -> review |
2022-04-27 16:02:23 | admin | set | messages: + msg6809 |
2022-04-26 00:00:00 | admin | create |