Movatterモバイル変換


[0]ホーム

URL:


Issue 2235 - WG21 CWG Issues
Title
Partial ordering and non-dependent types
Status
cd5
Section
13.10.3.5 [temp.deduct.partial]
Submitter
Richard Smith

Created on2017-02-06.00:00:00 last changed56 months ago

Messages

msg5874 (view)
Date: 2017-11-15.00:00:00

Proposed resolution (November, 2017)

  1. Change 13.10.3.5 [temp.deduct.partial] paragraph 4 asfollows:

  2. :
    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.
  3. Change 13.10.3.6 [temp.deduct.type] paragraph 4 as follows:

  4. ...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]
msg5846 (view)
Date: 2018-03-15.00:00:00

[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
DateUserActionArgs
2020-12-15 00:00:00adminsetstatus: dr -> cd5
2018-04-11 00:00:00adminsetstatus: tentatively ready -> dr
2018-02-27 00:00:00adminsetmessages: +msg5874
2018-02-27 00:00:00adminsetstatus: open -> tentatively ready
2017-02-06 00:00:00admincreate

[8]ページ先頭

©2009-2025 Movatter.jp