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
Template parameter pack that does not participate in template argument deduction #4555
Comments
None of the rules you quoted say anything about when a template parameter does or does not participate in template argument deduction, so I'm not seeing your point. (I believe the T pack does participate in template argument deduction here.) Note [temp.deduct.type] p4
(Nothing is explicitly specified and this is not a non-deducible context.) |
I think the quote you cited here might apply to such a case: template<class T>
T fun(T); In a function call, In the first snippet, pack |
So, the point you're making is that the T pack doesn't appear in the function parameters, so template argument deduction can't possibly deduce it. Which means we need wording elsewhere to say what T is in the example above. The text
was made a note in P1787R6. |
This seems to be an issue in the wording, but it feels far from editorial. |
Yes, That's exactly what I'm concerning here. Moreover, it seems such a case can only apply to those packs that do not parcipate in deduction. template<class...T>
struct Tuple{
Tuple(int);
};
template<class...T>
void fun(Tuple<T...>);
int main(){
fun(0); //invalid
} Since it violates [temp.deduct.call#4] |
According to [temp.deduct.call]
In this example
As per the above rule, the template parameter pack does not participate in template argument deduction. If there were no other special rule specified, as per
The deduction would fail since the template argument for the template parameter pack is neither deduced(the pack does not participate in the deduction process) nor explicitly specified.
However, in the older standard, there's a special rule states that:
However, such a normative rule has become a note in the current draft. I think such a rule should be a normative rule since there's no other alternative rule that states similar things. Making it to be a note is not persuasive to explain why can
#1
be otherwise deduced successfully.The text was updated successfully, but these errors were encountered: