cplusplus / cplusplus/draft

[temp.deduct.general] p1 What are these necessary template arguments when referring to a function template specialization

Open
#5,344 0 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

[temp.deduct.general] p1 just states that:

When a function template specialization is referenced, all of the template arguments shall have values.

So, what are the necessary template arguments when referring to a function template specialization without using a template-id? It seems to we have no special rule that explicitly specify this point. For example:

template<class U, class T>
U fun(T){};
fun(0);  // #1

According to [temp.deduct.call], the deduction is successful for T since the deduction only concerns the function parameter. The note [temp.deduct.call.note]/1 implies that the template-argument must be explicitly specified for U. Besides that, we have no formal rule to interpret why. Although [temp.deduct.general] p1 requires that all of the template arguments shall have values, however in this case, what are the necessary template arguments when referring to the specialization? I would expect that [temp.names] p7 can work here to interpret the aforementioned issue.

A template-id is valid if

  • [...]
  • there is an argument for each non-deducible non-pack parameter that does not have a default template-argument

Although the specialization referred to at #1 does not syntactically satisfy a template-id, however, it is as if the specialization were referred to by a template-id, merely, the template-argument-list is permitted to omit as per [temp.arg.explicit] p4.

For this issue, we just need a formal rule(like [temp.names] p7) to specify that we need two template arguments for parameters U and T in this case.

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

Read [temp.deduct.general] p1, [temp.deduct.call] and its note, then compare [temp.names] p7 with [temp.arg.explicit] p4 and the example at #1. The issue is resolved when the draft has a formal rule explaining which template arguments are required when a function template specialization is referenced without a template-id.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.