Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xmh0511 opened this issue Mar 15, 2022 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Mar 15, 2022

[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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant