Created on2017-02-06.00:00:00 last changed56 months ago
Proposed resolution (November, 2017)
Change 13.10.3.5 [temp.deduct.partial] paragraph 4 asfollows:
Each type nominated above from the parameter template and the correspondingtype from the argument template are used as the types ofPandA.If a particularP containsnotemplate-parameters that participate in template argumentdeduction, thatP is not used to determine the ordering.
Change 13.10.3.6 [temp.deduct.type] paragraph 4 as follows:
...If a template parameter is used only in non-deduced contexts and is notexplicitly specified, template argument deduction fails. [Note:Under 13.10.3.2 [temp.deduct.call]and13.10.3.5 [temp.deduct.partial], ifP containsnotemplate-parameters that appear in deduced contexts, no deductionis done, soP andA need not have the sameform. —end note]
[Accepted as a DR at the March, 2018 (Jacksonville) meeting.]
Paragraph 12 of 13.10.3.5 [temp.deduct.partial] contains the followingexample:
template <class T> T f(int); // #1 template <class T, class U> T f(U); // #2 void g() { f<int>(1); // calls #1 }
However, paragraph 4 states,
If a particularP contains notemplate-parameters thatparticipate in template argument deduction, thatP is not used todetermine the ordering.
Thus, we ignore theP=int,A=U case and deductionsucceeds for theP=U,A=int case, so both templatesare at least as specialized as each other. And consider:
template <class... T> struct V {}; template <class... Ts, class... Us> void Foo(V<Ts...>, V<Us&...>) {} // #3 template <class... Us> void Foo(V<>, V<Us&...>) {} // #4 void h() { Foo(V<>(), V<>()); }
The intent is that this should call #4; that template clearly ought tobe more specialized.
History | |||
---|---|---|---|
Date | User | Action | Args |
2020-12-15 00:00:00 | admin | set | status: dr -> cd5 |
2018-04-11 00:00:00 | admin | set | status: tentatively ready -> dr |
2018-02-27 00:00:00 | admin | set | messages: +msg5874 |
2018-02-27 00:00:00 | admin | set | status: open -> tentatively ready |
2017-02-06 00:00:00 | admin | create |