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.type] p4 Template parameter pack is only used in non-deduced context #5343

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

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Mar 15, 2022

[temp.deduct.type] p4 states that:

If a template parameter is used only in non-deduced contexts and is not explicitly specified, template argument deduction fails.

Consider this example:

template<class...T, class U>
void fun(T...,U){
}
fun(0); // all major implementations accept it.

[temp.deduct.type] p5 states that the template parameter pack T is used in a non-deduced context:

The non-deduced contexts are:

  • [...]
  • A function parameter pack that does not occur at the end of the parameter-declaration-list.

The parameter is only used in a non-deduced context. [temp.arg.explicit.note]/1 also implies the example is ok. The following change may be an improvement:

If a template parameter that is not a template parameter pack is used only in non-deduced contexts and is not explicitly specified, template argument deduction fails.

Relevant issue: #4555

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