cplusplus / cplusplus/draft

The structure of the rule of producing a transformed template when partial ordering

Open
#4,547 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

In order to determine which of the two function templates is more specialized, partial ordering is used to select the best candidate; This process needs a pair of type(The deduction process uses the transformed type as the argument template and the original type of the other template as the parameter template.)
The relevant rule is written in temp.func.order#3

  1. To produce the transformed template, for each type, non-type, or template template parameter (including template parameter packs thereof) synthesize a unique type, value, or class template respectively and substitute it for each occurrence of that parameter in the function type of the template.
    Each function template M that is a member function is considered to have a new first parameter of type X(M), described below, inserted in its function parameter list. [...]

3.1 [...]
3.2 [...]

The first issue is:
This structure of the rule looks like adding an extra implicit object parameter to the function parameter list is a part of producing the transformed template. In other words, the original type of the member function does not have the implicit object parameter. That would make two candidates functions in which one is a member function template to be non-comparable? Because the transformed template of the non-member function does not have the same number of parameters as the original template of the member function template. Is it necessary to take the rule which describes that the parameter list of a member function template has an extra parameter out to make it to be an individual rule? And that rule will precede the rule of producing a transformed template.

The second issue is:

If exactly one of the function templates was considered by overload resolution via a rewritten candidate ([over.match.oper]) with a reversed order of parameters, then the order of the function parameters in its transformed template is reversed.

For this rule, Isn't the rule a bit misleading? Presumably, it says that the synthesized candidate is used to participate in the partial ordering. However, the synthesized candidate is in the overload set instead of the original function template which is rewritten by reversing the order of parameters. I mean the viable function template is not the original function template, so it does not be considered by overload resolution. Reversing the order of parameters of a synthesized function template does not make sense.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with [temp.func.order#3] and compare its transformed-template rules with [over.match.oper], focusing on member-function object parameters and reversed rewritten candidates. Determine whether the standard wording accurately describes the candidates used in partial ordering; done means resolving the two questions with an agreed wording change or rationale.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.